diff --git a/demo/index.html b/demo/index.html index 3d6d4981..0f2afa2d 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,5 +1,15 @@ +

Symphony Electron API Demo

@@ -75,7 +85,21 @@

Get Version Info:


- Version Info: + Version Info: + + + + + + + + + + + + + +
API VersionContainer IdentifierContainer VersionBuild Number
diff --git a/js/preload/preloadMain.js b/js/preload/preloadMain.js index e97a7dc6..83bc94c4 100644 --- a/js/preload/preloadMain.js +++ b/js/preload/preloadMain.js @@ -21,6 +21,7 @@ const getMediaSources = require('../desktopCapturer/getSources'); const getMediaSource = require('../desktopCapturer/getSource'); const { TitleBar, updateContentHeight } = require('../windowsTitlebar'); const titleBar = new TitleBar(); +const { buildNumber } = require('../../package.json'); require('../downloadManager'); @@ -90,6 +91,7 @@ function createAPI() { const verInfo = { containerIdentifier: appName, containerVer: appVer, + buildNumber: buildNumber, apiVer: '1.0.0' }; resolve(verInfo); diff --git a/package.json b/package.json index 527c892a..afa708e7 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "url": "https://support.symphony.com" }, "devDependencies": { + "bluebird": "3.5.1", "browserify": "14.5.0", "cross-env": "3.2.4", "electron": "1.8.3", diff --git a/tests/spectron/getVersionInfo.spectron.js b/tests/spectron/getVersionInfo.spectron.js new file mode 100644 index 00000000..351659b0 --- /dev/null +++ b/tests/spectron/getVersionInfo.spectron.js @@ -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(); + }); + }); +}); \ No newline at end of file