SymphonyElectron/spectron/spell-checker.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

38 lines
1.1 KiB
TypeScript

import test from 'ava';
import * as robot from 'robotjs';
import { Application } from 'spectron';
import { getDemoFilePath, loadURL, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
let app;
test.before(async (t) => {
app = await startApplication() as Application;
t.true(app.isRunning());
});
test.after.always(async () => {
await stopApplication(app);
});
test('spell-checker: verify application spell checking feature', async (t) => {
robot.setKeyboardDelay(Timeouts.oneSec);
const missSpelledWord = 'teest ';
await loadURL(app, getDemoFilePath());
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
await app.client.electron.remote.clipboard.writeText(missSpelledWord);
await app.client.click('#tag');
await app.client.webContents.paste();
await app.client.waitForValue('#tag', Timeouts.fiveSec);
t.is(await app.client.getValue('#tag'), missSpelledWord);
await app.client.rightClick('#tag', 10, 10);
robot.keyTap('down');
robot.keyTap('enter');
t.not(await app.client.getValue('#tag'), missSpelledWord);
});