SymphonyElectron/spectron/notification.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.3 KiB
TypeScript

import test from 'ava';
import { Application } from 'spectron';
import { getDemoFilePath, loadURL, sleep, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
let app;
test.before(async (t) => {
app = await startApplication(true) as Application;
t.true(app.isRunning());
});
test.after.always(async () => {
await stopApplication(app);
});
test('Verify is the application is running', async (t) => {
t.true(app.isRunning());
});
test('Verify notification window is created', async (t) => {
await loadURL(app, getDemoFilePath());
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
await app.client.click('#notf');
await sleep(Timeouts.oneSec);
t.timeout(10000);
t.is(await app.client.getWindowCount(), 2);
await app.client.windowByIndex(1);
await app.client.click('.close');
await sleep(2000);
await app.client.windowByIndex(0);
});
test('Verify notification window is hidden', async (t) => {
await app.client.click('#notf');
await sleep(Timeouts.oneSec);
t.timeout(Timeouts.fiveSec);
await app.client.windowByIndex(1);
await app.client.click('.close');
await sleep(2000);
await app.client.windowByIndex(0);
t.is(await app.client.getWindowCount(), 2);
});