SymphonyElectron/spectron/full-screen.spec.ts

36 lines
854 B
TypeScript
Raw Normal View History

import test from 'ava';
import * as robot from 'robotjs';
import { Application } from 'spectron';
import { robotActions } from './fixtures/robot-actions';
import {
2021-01-29 00:25:40 -06:00
getDemoFilePath,
loadURL,
sleep,
startApplication,
stopApplication,
Timeouts,
} from './fixtures/spectron-setup';
let app;
test.before(async (t) => {
2021-01-29 00:25:40 -06:00
app = (await startApplication()) as Application;
t.true(app.isRunning());
});
test.after.always(async () => {
2021-01-29 00:25:40 -06:00
await stopApplication(app);
});
test('fullscreen: verify application full screen feature', async (t) => {
2021-01-29 00:25:40 -06:00
await loadURL(app, getDemoFilePath());
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
robotActions.toggleFullscreen();
t.true(await app.browserWindow.isFullScreen());
2021-01-29 00:25:40 -06:00
await sleep(Timeouts.halfSec);
robot.keyTap('escape');
t.false(await app.browserWindow.isFullScreen());
});