Electron-318 (Included build number in the client version info) (#314)

1. Included build number in getVersionInfo method
2. Update the demo page version info to table view
3. Changed let to var to make it consistent across the file
4. Add Spectron test cases for getVersionInfo
This commit is contained in:
Kiran Niranjan
2018-03-12 17:05:25 +05:30
committed by Vishwas Shashidhar
parent ff803e3a24
commit 191ca0c05e
4 changed files with 111 additions and 8 deletions

View File

@@ -0,0 +1,71 @@
const Application = require('./spectronSetup');
const path = require('path');
const { buildNumber } = require('../../package');
const bluebird = require('bluebird');
let app = new Application({});
describe('Tests for getVersionInfo API', () => {
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
beforeAll((done) => {
return app.startApplication().then((startedApp) => {
app = startedApp;
done();
}).catch((err) => {
console.error(`Unable to start application error: ${err}`);
expect(err).toBeNull();
done();
});
});
afterAll((done) => {
if (app && app.isRunning()) {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
app.stop().then(() => {
done();
}).catch((err) => {
done();
});
}
});
it('should launch the app', (done) => {
return app.client.waitUntilWindowLoaded().then(() => {
return app.client.getWindowCount().then((count) => {
expect(count === 1).toBeTruthy();
done();
}).catch((err) => {
expect(err).toBeNull();
});
}).catch((err) => {
expect(err).toBeNull();
});
});
it('should load demo html page', () => {
return app.client.url('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
});
it('should verify if the version numbers are correct', function (done) {
app.client.waitForExist('#get-version', 2000);
app.client.click('#get-version');
bluebird.all([
'#api-version',
'#container-identifier',
'#container-ver',
'#build-number'
]).mapSeries((string) => {
return app.client.getText(string)
}).then((values) => {
expect(values[ 0 ]).toBe('1.0.0');
expect(values[ 1 ]).toBe('Electron');
expect(values[ 2 ]).toBe('1.8.3');
expect(values[ 3 ]).toBe(buildNumber);
done();
});
});
});