mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #500 from thaisym1912/AVT-1147
AVT-1147 [Spectron] Review and update the existing tests in getVersionInfo.spectron
This commit is contained in:
commit
e23075445f
@ -1,75 +1,47 @@
|
||||
const Application = require('./spectronSetup');
|
||||
const WebActions = require('./spectronWebActions');
|
||||
const WindowsActions = require('./spectronWindowsActions');
|
||||
const constants = require('./spectronConstants.js');
|
||||
const path = require('path');
|
||||
const { buildNumber } = require('../../package');
|
||||
const electronVersion = require('../../package').devDependencies.electron;
|
||||
const bluebird = require('bluebird');
|
||||
const ui = require('./spectronInterfaces.js');
|
||||
|
||||
const API_VERSION = '2.0.0';
|
||||
const SEARCH_API_VERSION = '3.0.0';
|
||||
|
||||
let app = new Application({});
|
||||
let app, windowsActions;
|
||||
|
||||
describe('Tests for getVersionInfo API', () => {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
|
||||
|
||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
||||
|
||||
beforeAll((done) => {
|
||||
return app.startApplication().then((startedApp) => {
|
||||
app = startedApp;
|
||||
beforeAll(async (done) => {
|
||||
try {
|
||||
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
||||
webActions = await new WebActions(app);
|
||||
windowsActions = await new WindowsActions(app);
|
||||
done();
|
||||
}).catch((err) => {
|
||||
} catch (err) {
|
||||
await windowsActions.stopApp();
|
||||
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) => {
|
||||
afterAll(async (done) => {
|
||||
try {
|
||||
await windowsActions.stopApp();
|
||||
done();
|
||||
} catch (err) {
|
||||
done.fail(new Error(`Failed at post-condition: ${err}`));
|
||||
};
|
||||
});
|
||||
|
||||
it('Should verify if the version numbers are correct', async (done) => {
|
||||
try {
|
||||
if (await windowsActions.isAppRunning()) {
|
||||
await webActions.navigateURL('file:///' + path.join(__dirname, '..', '..', 'demo/index.html'));
|
||||
await windowsActions.bringToFront("Symphony");
|
||||
await webActions.clickIfElementVisible(ui.GET_VERSION_BUTTON);
|
||||
await webActions.verifyVersionInfo();
|
||||
}
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
} catch (err) {
|
||||
done.fail(new Error(`Fail to verify the version numbers: ${err}`));
|
||||
};
|
||||
});
|
||||
});
|
@ -90,6 +90,9 @@ module.exports= {
|
||||
//INPUT SEARCH
|
||||
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
|
||||
|
||||
//Symphony Electron API Demo
|
||||
GET_VERSION_BUTTON: "#get-version",
|
||||
|
||||
//Symphony Electron API Demo
|
||||
TAG_TEXTBOX: "#tag"
|
||||
};
|
||||
|
@ -413,6 +413,32 @@ class WebActions {
|
||||
}
|
||||
await robot.keyTap('enter');
|
||||
}
|
||||
|
||||
async verifyVersionInfo(){
|
||||
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 values = await bluebird.all([
|
||||
'#api-version',
|
||||
'#container-identifier',
|
||||
'#container-ver',
|
||||
'#build-number',
|
||||
'#search-api-ver'
|
||||
]).mapSeries((string) => {return this.app.client.getText(string)})
|
||||
|
||||
await expect(values[ 0 ]).toBe(API_VERSION);
|
||||
await expect(values[ 1 ]).toBe('Electron');
|
||||
await expect(values[ 2 ]).toBe(electronVersion);
|
||||
await expect(values[ 3 ]).toBe(buildNumber);
|
||||
await expect(values[ 4 ]).toBe(SEARCH_API_VERSION);
|
||||
}
|
||||
|
||||
async navigateURL(url) {
|
||||
return this.app.client.url(url);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WebActions;
|
||||
|
Loading…
Reference in New Issue
Block a user