SymphonyElectron/tests/spectron/getVersionInfo.spectron.js
Keerthi Niranjan 205c08977d SEARCH-840 Updates searchApiVer and AIP (#438)
* SEARCH-840 Migrates SwiftSearch to a different project https://github.com/symphonyoss/SwiftSearch

* SEARCH-840 Changes swift-search require

* SEARCH-840 refactor

* SEARCH-840 Changes swift-search version

* SEARCH-840 Changes warn message

* SEARCH-840 Updates api version and removes unwanted libraries from aip
2018-07-20 14:12:51 +05:30

76 lines
2.5 KiB
JavaScript

const Application = require('./spectronSetup');
const path = require('path');
const { buildNumber } = require('../../package');
const electronVersion = require('../../package').devDependencies.electron;
const bluebird = require('bluebird');
const API_VERSION = '2.0.0';
const SEARCH_API_VERSION = '3.0.0';
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) => {
done.fail(new Error(`Unable to start application error: ${err}`));
});
});
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) => {
done.fail(new Error(`getVersionInfo failed in getWindowCount with error: ${err}`));
});
}).catch((err) => {
done.fail(new Error(`getVersionInfo failed in waitUntilWindowLoaded with error: ${err}`));
});
});
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',
'#search-api-ver'
]).mapSeries((string) => {
return app.client.getText(string)
}).then((values) => {
expect(values[ 0 ]).toBe(API_VERSION);
expect(values[ 1 ]).toBe('Electron');
expect(values[ 2 ]).toBe(electronVersion);
expect(values[ 3 ]).toBe(buildNumber);
expect(values[ 4 ]).toBe(SEARCH_API_VERSION);
done();
});
});
});