SymphonyElectron/spectron/about-app.spec.ts
Kiran Niranjan 873badf389
test: Spectron (Initial commit) (#838)
* Spectron - Initial commit

* Spectron - Only run unit tests on travis

* Spectron - Update npm script to copy config and refactor

* Spectron - Update readme

* Spectron - update test cases

* Spectron - Merge upstream Spectron

* Spectron - Update spectron to 10.0.0 and fix issues

* Spectron - rename travis file

* Spectron - install linux specific dependency

* Spectron - Fix indentation

* Spectron - Fix indentation

* Spectron - Remove unwanted script

* fix typo
2020-03-18 11:15:00 +05:30

48 lines
1.5 KiB
TypeScript

import test from 'ava';
import * as robot from 'robotjs';
import { Application } from 'spectron';
import { robotActions } from './fixtures/robot-actions';
import { loadURL, podUrl, sleep, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
let app;
test.before(async (t) => {
app = await startApplication() as Application;
t.true(app.isRunning());
await loadURL(app, podUrl);
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
await sleep(Timeouts.fiveSec);
});
test.after.always(async () => {
await stopApplication(app);
});
test('about-app: verify about application feature', async (t) => {
robotActions.clickAppMenu();
robot.keyTap('down');
robot.keyTap('enter');
// wait for about window to load
await sleep(Timeouts.halfSec);
await app.client.windowByIndex(1);
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
t.truthy(await app.browserWindow.getTitle(), 'About Symphony');
});
test('about-app: verify copy button with few data validation', async (t) => {
await sleep(Timeouts.oneSec);
await app.client.click('.AboutApp-copy-button');
const clipboard = JSON.parse(await app.client.electron.remote.clipboard.readText());
t.log(clipboard);
t.true(clipboard.hasOwnProperty('appName'));
t.true(clipboard.hasOwnProperty('clientVersion'));
t.true(clipboard.hasOwnProperty('sfeVersion'));
t.true(clipboard.hasOwnProperty('sdaVersion'));
t.true(clipboard.hasOwnProperty('sdaBuildNumber'));
robotActions.closeWindow();
});