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 Application = require('./spectronSetup');
|
||||||
|
const WebActions = require('./spectronWebActions');
|
||||||
|
const WindowsActions = require('./spectronWindowsActions');
|
||||||
|
const constants = require('./spectronConstants.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { buildNumber } = require('../../package');
|
const ui = require('./spectronInterfaces.js');
|
||||||
const electronVersion = require('../../package').devDependencies.electron;
|
|
||||||
const bluebird = require('bluebird');
|
|
||||||
|
|
||||||
const API_VERSION = '2.0.0';
|
let app, windowsActions;
|
||||||
const SEARCH_API_VERSION = '3.0.0';
|
|
||||||
|
|
||||||
let app = new Application({});
|
|
||||||
|
|
||||||
describe('Tests for getVersionInfo API', () => {
|
describe('Tests for getVersionInfo API', () => {
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = constants.TIMEOUT_TEST_SUITE;
|
||||||
|
|
||||||
let originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
beforeAll(async (done) => {
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = Application.getTimeOut();
|
try {
|
||||||
|
app = await new Application({}).startApplication({ testedHost: constants.TESTED_HOST, alwaysOnTop: true });
|
||||||
beforeAll((done) => {
|
webActions = await new WebActions(app);
|
||||||
return app.startApplication().then((startedApp) => {
|
windowsActions = await new WindowsActions(app);
|
||||||
app = startedApp;
|
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
} catch (err) {
|
||||||
|
await windowsActions.stopApp();
|
||||||
done.fail(new Error(`Unable to start application error: ${err}`));
|
done.fail(new Error(`Unable to start application error: ${err}`));
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll((done) => {
|
afterAll(async (done) => {
|
||||||
if (app && app.isRunning()) {
|
try {
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
await windowsActions.stopApp();
|
||||||
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();
|
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();
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
} catch (err) {
|
||||||
|
done.fail(new Error(`Fail to verify the version numbers: ${err}`));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
@ -90,6 +90,9 @@ module.exports= {
|
|||||||
//INPUT SEARCH
|
//INPUT SEARCH
|
||||||
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
|
INPUT_SEARCH_ENTITIES: "//input[@id='search-entities']",
|
||||||
|
|
||||||
|
//Symphony Electron API Demo
|
||||||
|
GET_VERSION_BUTTON: "#get-version",
|
||||||
|
|
||||||
//Symphony Electron API Demo
|
//Symphony Electron API Demo
|
||||||
TAG_TEXTBOX: "#tag"
|
TAG_TEXTBOX: "#tag"
|
||||||
};
|
};
|
||||||
|
@ -413,6 +413,32 @@ class WebActions {
|
|||||||
}
|
}
|
||||||
await robot.keyTap('enter');
|
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;
|
module.exports = WebActions;
|
||||||
|
Loading…
Reference in New Issue
Block a user