mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-24 09:50:51 -06:00
Add spectron test for zoom functionality (#948)
This commit is contained in:
parent
86854315b3
commit
e1bf469206
@ -26,6 +26,33 @@ class RobotActions {
|
|||||||
robot.keyToggle('f', 'up', [ 'command', 'control' ]);
|
robot.keyToggle('f', 'up', [ 'command', 'control' ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zoom in via keyboard Command/Ctrl +
|
||||||
|
*/
|
||||||
|
public zoomIn(): void {
|
||||||
|
const modifier = isMac ? [ 'command' ] : [ 'control' ];
|
||||||
|
robot.keyToggle('+', 'down', modifier);
|
||||||
|
robot.keyToggle('+', 'up', modifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zoom out via keyboard
|
||||||
|
*/
|
||||||
|
public zoomOut(): void {
|
||||||
|
const modifier = isMac ? [ 'command' ] : [ 'control' ];
|
||||||
|
robot.keyToggle('-', 'down', modifier);
|
||||||
|
robot.keyToggle('-', 'up', modifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zoom reset via keyboard
|
||||||
|
*/
|
||||||
|
public zoomReset(): void {
|
||||||
|
const modifier = isMac ? [ 'command' ] : [ 'control' ];
|
||||||
|
robot.keyToggle('0', 'down', modifier);
|
||||||
|
robot.keyToggle('0', 'up', modifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Click the App menu
|
* Click the App menu
|
||||||
*/
|
*/
|
||||||
|
42
spectron/zoom.spec.ts
Normal file
42
spectron/zoom.spec.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import test from 'ava';
|
||||||
|
import { Application } from 'spectron';
|
||||||
|
import { robotActions } from './fixtures/robot-actions';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getDemoFilePath, loadURL,
|
||||||
|
sleep,
|
||||||
|
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('zoom: verify application zoom feature', async (t) => {
|
||||||
|
await loadURL(app, getDemoFilePath());
|
||||||
|
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||||
|
|
||||||
|
robotActions.zoomIn();
|
||||||
|
t.is(await app.webContents.getZoomLevel(), 0.5);
|
||||||
|
await sleep(Timeouts.oneSec);
|
||||||
|
|
||||||
|
robotActions.zoomIn();
|
||||||
|
t.is(await app.webContents.getZoomLevel(), 1);
|
||||||
|
await sleep(Timeouts.oneSec);
|
||||||
|
|
||||||
|
robotActions.zoomOut();
|
||||||
|
t.is(await app.webContents.getZoomLevel(), 0.5);
|
||||||
|
await sleep(Timeouts.oneSec);
|
||||||
|
|
||||||
|
robotActions.zoomReset();
|
||||||
|
t.is(await app.webContents.getZoomLevel(), 0);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user