mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-25 02:10:32 -06:00
873badf389
* 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
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import test from 'ava';
|
|
import * as robot from 'robotjs';
|
|
import { Application } from 'spectron';
|
|
|
|
import {
|
|
getDemoFilePath, loadURL,
|
|
sleep,
|
|
startApplication,
|
|
stopApplication,
|
|
Timeouts,
|
|
} from './fixtures/spectron-setup';
|
|
|
|
let app;
|
|
|
|
export const openScreenPicker = async (window) => {
|
|
if (!window) {
|
|
throw new Error('openScreenPicker: must be called with Application');
|
|
}
|
|
await window.client.scroll(125, 1000);
|
|
await sleep(Timeouts.halfSec);
|
|
await window.client.click('#get-sources');
|
|
await window.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
|
};
|
|
|
|
test.before(async (t) => {
|
|
app = await startApplication() as Application;
|
|
t.true(app.isRunning());
|
|
});
|
|
|
|
test.after.always(async () => {
|
|
await stopApplication(app);
|
|
});
|
|
|
|
test('screen-picker: verify screen-picker close button', async (t) => {
|
|
await loadURL(app, getDemoFilePath());
|
|
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
|
await openScreenPicker(app);
|
|
|
|
await sleep(Timeouts.halfSec);
|
|
t.is(await app.client.getWindowCount(), 2);
|
|
await app.client.windowByIndex(1);
|
|
await app.client.click('.ScreenPicker-x-button');
|
|
await sleep(Timeouts.halfSec);
|
|
t.is(await app.client.getWindowCount(), 1);
|
|
});
|
|
|
|
test('screen-picker: verify screen-picker escape keyboard actions', async (t) => {
|
|
await app.client.windowByIndex(0);
|
|
await openScreenPicker(app);
|
|
|
|
await sleep(Timeouts.halfSec);
|
|
t.is(await app.client.getWindowCount(), 2);
|
|
robot.keyTap('escape');
|
|
await sleep(Timeouts.halfSec);
|
|
t.is(await app.client.getWindowCount(), 1);
|
|
});
|