SymphonyElectron/tests/spectron/getVersionInfo.spectron.js
Kiran Niranjan 191ca0c05e 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
2018-03-12 17:05:25 +05:30

71 lines
2.2 KiB
JavaScript

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();
});
});
});