mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
format all files with prettier
This commit is contained in:
@@ -2,47 +2,56 @@ import test from 'ava';
|
||||
import * as robot from 'robotjs';
|
||||
import { Application } from 'spectron';
|
||||
import { robotActions } from './fixtures/robot-actions';
|
||||
import { loadURL, podUrl, sleep, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
|
||||
import {
|
||||
loadURL,
|
||||
podUrl,
|
||||
sleep,
|
||||
startApplication,
|
||||
stopApplication,
|
||||
Timeouts,
|
||||
} from './fixtures/spectron-setup';
|
||||
|
||||
let app;
|
||||
|
||||
test.before(async (t) => {
|
||||
app = await startApplication() as Application;
|
||||
t.true(app.isRunning());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
|
||||
await loadURL(app, podUrl);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
await loadURL(app, podUrl);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
|
||||
await sleep(Timeouts.fiveSec);
|
||||
await sleep(Timeouts.fiveSec);
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('about-app: verify about application feature', async (t) => {
|
||||
robotActions.clickAppMenu();
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('enter');
|
||||
robotActions.clickAppMenu();
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('enter');
|
||||
|
||||
// wait for about window to load
|
||||
await sleep(Timeouts.halfSec);
|
||||
await app.client.windowByIndex(1);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
t.truthy(await app.browserWindow.getTitle(), 'About Symphony');
|
||||
// wait for about window to load
|
||||
await sleep(Timeouts.halfSec);
|
||||
await app.client.windowByIndex(1);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
t.truthy(await app.browserWindow.getTitle(), 'About Symphony');
|
||||
});
|
||||
|
||||
test('about-app: verify copy button with few data validation', async (t) => {
|
||||
await sleep(Timeouts.oneSec);
|
||||
await app.client.click('.AboutApp-copy-button');
|
||||
const clipboard = JSON.parse(await app.client.electron.remote.clipboard.readText());
|
||||
await sleep(Timeouts.oneSec);
|
||||
await app.client.click('.AboutApp-copy-button');
|
||||
const clipboard = JSON.parse(
|
||||
await app.client.electron.remote.clipboard.readText(),
|
||||
);
|
||||
|
||||
t.log(clipboard);
|
||||
t.true(clipboard.hasOwnProperty('appName'));
|
||||
t.true(clipboard.hasOwnProperty('clientVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeClientType'));
|
||||
t.true(clipboard.hasOwnProperty('sdaVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sdaBuildNumber'));
|
||||
robotActions.closeWindow();
|
||||
t.log(clipboard);
|
||||
t.true(clipboard.hasOwnProperty('appName'));
|
||||
t.true(clipboard.hasOwnProperty('clientVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sfeClientType'));
|
||||
t.true(clipboard.hasOwnProperty('sdaVersion'));
|
||||
t.true(clipboard.hasOwnProperty('sdaBuildNumber'));
|
||||
robotActions.closeWindow();
|
||||
});
|
||||
|
||||
@@ -3,75 +3,72 @@ import { isMac } from '../../src/common/env';
|
||||
import { Timeouts } from './spectron-setup';
|
||||
|
||||
class RobotActions {
|
||||
constructor() {
|
||||
robot.setKeyboardDelay(Timeouts.oneSec);
|
||||
robot.setMouseDelay(Timeouts.oneSec);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
robot.setKeyboardDelay(Timeouts.oneSec);
|
||||
robot.setMouseDelay(Timeouts.oneSec);
|
||||
}
|
||||
/**
|
||||
* Closes window via keyboard action
|
||||
*/
|
||||
public closeWindow(): void {
|
||||
const modifier = isMac ? ['command'] : ['control'];
|
||||
robot.keyToggle('w', 'down', modifier);
|
||||
robot.keyToggle('w', 'up', modifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes window via keyboard action
|
||||
*/
|
||||
public closeWindow(): void {
|
||||
const modifier = isMac ? [ 'command' ] : [ 'control' ];
|
||||
robot.keyToggle('w', 'down', modifier);
|
||||
robot.keyToggle('w', 'up', modifier);
|
||||
}
|
||||
/**
|
||||
* Makes the application fullscreen via keyboard
|
||||
*/
|
||||
public toggleFullscreen(): void {
|
||||
robot.keyToggle('f', 'down', ['command', 'control']);
|
||||
robot.keyToggle('f', 'up', ['command', 'control']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the application fullscreen via keyboard
|
||||
*/
|
||||
public toggleFullscreen(): void {
|
||||
robot.keyToggle('f', 'down', [ '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 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 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public clickAppMenu(point?: Electron.Point): void {
|
||||
if (isMac) {
|
||||
robot.moveMouse(83, 14);
|
||||
robot.mouseClick();
|
||||
} else {
|
||||
if (!point) {
|
||||
throw new Error('browser window points are required');
|
||||
}
|
||||
robot.moveMouse(point.x + 10, point.y + 14);
|
||||
robot.mouseClick();
|
||||
}
|
||||
/**
|
||||
* Click the App menu
|
||||
*/
|
||||
public clickAppMenu(point?: Electron.Point): void {
|
||||
if (isMac) {
|
||||
robot.moveMouse(83, 14);
|
||||
robot.mouseClick();
|
||||
} else {
|
||||
if (!point) {
|
||||
throw new Error('browser window points are required');
|
||||
}
|
||||
robot.moveMouse(point.x + 10, point.y + 14);
|
||||
robot.mouseClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const robotActions = new RobotActions();
|
||||
|
||||
export {
|
||||
robotActions,
|
||||
};
|
||||
export { robotActions };
|
||||
|
||||
@@ -4,47 +4,63 @@ import { Application, BasicAppSettings } from 'spectron';
|
||||
export const podUrl = 'https://corporate.symphony.com';
|
||||
|
||||
export enum Timeouts {
|
||||
halfSec = 500,
|
||||
oneSec = 1000,
|
||||
threeSec = 3000,
|
||||
fiveSec = 5000,
|
||||
tenSec = 10000,
|
||||
halfSec = 500,
|
||||
oneSec = 1000,
|
||||
threeSec = 3000,
|
||||
fiveSec = 5000,
|
||||
tenSec = 10000,
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the electron executable path
|
||||
*/
|
||||
export const getElectronPath = (): string => {
|
||||
let electronPath = path.join(__dirname, '..', '..', '..', 'node_modules', '.bin', 'electron');
|
||||
if (process.platform === 'win32') {
|
||||
electronPath += '.cmd';
|
||||
}
|
||||
return electronPath;
|
||||
let electronPath = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'node_modules',
|
||||
'.bin',
|
||||
'electron',
|
||||
);
|
||||
if (process.platform === 'win32') {
|
||||
electronPath += '.cmd';
|
||||
}
|
||||
return electronPath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the demo application html path
|
||||
*/
|
||||
export const getDemoFilePath = (): string => {
|
||||
return `file://${path.join(__dirname, '..', '..', '..', '/src/demo/index.html')}`;
|
||||
return `file://${path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'/src/demo/index.html',
|
||||
)}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns app init file
|
||||
*/
|
||||
export const getArgs = (): string[] => {
|
||||
return [ path.join(__dirname, '..', '..', '/src/app/init.js') ];
|
||||
return [path.join(__dirname, '..', '..', '/src/app/init.js')];
|
||||
};
|
||||
|
||||
/**
|
||||
* Stops the application
|
||||
* @param application
|
||||
*/
|
||||
export const stopApplication = async (application): Promise<Application | undefined> => {
|
||||
if (!application || !application.isRunning()) {
|
||||
return;
|
||||
}
|
||||
return await application.stop();
|
||||
export const stopApplication = async (
|
||||
application,
|
||||
): Promise<Application | undefined> => {
|
||||
if (!application || !application.isRunning()) {
|
||||
return;
|
||||
}
|
||||
return await application.stop();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -53,19 +69,19 @@ export const stopApplication = async (application): Promise<Application | undefi
|
||||
* @param options {BasicAppSettings}
|
||||
*/
|
||||
export const startApplication = async (
|
||||
shouldLoadDemoApp: boolean = false,
|
||||
options: BasicAppSettings = {
|
||||
path: getElectronPath(),
|
||||
args: getArgs(),
|
||||
},
|
||||
shouldLoadDemoApp: boolean = false,
|
||||
options: BasicAppSettings = {
|
||||
path: getElectronPath(),
|
||||
args: getArgs(),
|
||||
},
|
||||
): Promise<Application> => {
|
||||
// loads demo page correctly
|
||||
if (shouldLoadDemoApp && options.args) {
|
||||
options.args.push(`. --url=file://${getDemoFilePath()}`);
|
||||
}
|
||||
const application = new Application(options);
|
||||
await application.start();
|
||||
return application;
|
||||
// loads demo page correctly
|
||||
if (shouldLoadDemoApp && options.args) {
|
||||
options.args.push(`. --url=file://${getDemoFilePath()}`);
|
||||
}
|
||||
const application = new Application(options);
|
||||
await application.start();
|
||||
return application;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -73,9 +89,9 @@ export const startApplication = async (
|
||||
* @param ms
|
||||
*/
|
||||
export const sleep = (ms) => {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -85,13 +101,15 @@ export const sleep = (ms) => {
|
||||
* @param url
|
||||
*/
|
||||
export const loadURL = async (app: Application, url: string): Promise<void> => {
|
||||
try {
|
||||
return await app.browserWindow.loadURL(url);
|
||||
} catch (error) {
|
||||
const errorIsNavigatedError: boolean = error.message.includes('Inspected target navigated or closed');
|
||||
try {
|
||||
return await app.browserWindow.loadURL(url);
|
||||
} catch (error) {
|
||||
const errorIsNavigatedError: boolean = error.message.includes(
|
||||
'Inspected target navigated or closed',
|
||||
);
|
||||
|
||||
if (!errorIsNavigatedError) {
|
||||
throw error;
|
||||
}
|
||||
if (!errorIsNavigatedError) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,31 +4,32 @@ import { Application } from 'spectron';
|
||||
import { robotActions } from './fixtures/robot-actions';
|
||||
|
||||
import {
|
||||
getDemoFilePath, loadURL,
|
||||
sleep,
|
||||
startApplication,
|
||||
stopApplication,
|
||||
Timeouts,
|
||||
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());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('fullscreen: verify application full screen feature', async (t) => {
|
||||
await loadURL(app, getDemoFilePath());
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
robotActions.toggleFullscreen();
|
||||
t.true(await app.browserWindow.isFullScreen());
|
||||
await loadURL(app, getDemoFilePath());
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
robotActions.toggleFullscreen();
|
||||
t.true(await app.browserWindow.isFullScreen());
|
||||
|
||||
await sleep(Timeouts.halfSec);
|
||||
robot.keyTap('escape');
|
||||
t.false(await app.browserWindow.isFullScreen());
|
||||
await sleep(Timeouts.halfSec);
|
||||
robot.keyTap('escape');
|
||||
t.false(await app.browserWindow.isFullScreen());
|
||||
});
|
||||
|
||||
@@ -7,28 +7,28 @@ import { startApplication, stopApplication } from './fixtures/spectron-setup';
|
||||
let app;
|
||||
|
||||
test.before(async (t) => {
|
||||
app = await startApplication() as Application;
|
||||
t.true(app.isRunning());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('minimize: verify application minimize / maximize feature', async (t) => {
|
||||
const win = app.browserWindow;
|
||||
win.minimize();
|
||||
t.true(await win.isMinimized());
|
||||
const win = app.browserWindow;
|
||||
win.minimize();
|
||||
t.true(await win.isMinimized());
|
||||
|
||||
win.restore();
|
||||
t.true(await win.isVisible());
|
||||
win.restore();
|
||||
t.true(await win.isVisible());
|
||||
});
|
||||
|
||||
test('minimize: verify application to be minimized with keyboard accelerator', async (t) => {
|
||||
const win = app.browserWindow;
|
||||
robotActions.closeWindow();
|
||||
t.false(await win.isVisible());
|
||||
const win = app.browserWindow;
|
||||
robotActions.closeWindow();
|
||||
t.false(await win.isVisible());
|
||||
|
||||
win.restore();
|
||||
t.true(await win.isVisible());
|
||||
win.restore();
|
||||
t.true(await win.isVisible());
|
||||
});
|
||||
|
||||
@@ -1,47 +1,54 @@
|
||||
import test from 'ava';
|
||||
import { Application } from 'spectron';
|
||||
|
||||
import { getDemoFilePath, loadURL, sleep, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
|
||||
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());
|
||||
app = (await startApplication(true)) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('Verify is the application is running', async (t) => {
|
||||
t.true(app.isRunning());
|
||||
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 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(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);
|
||||
await sleep(2000);
|
||||
await app.client.windowByIndex(0);
|
||||
});
|
||||
|
||||
test('Verify notification window is hidden', async (t) => {
|
||||
await app.client.click('#notf');
|
||||
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(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);
|
||||
await sleep(2000);
|
||||
await app.client.windowByIndex(0);
|
||||
t.is(await app.client.getWindowCount(), 2);
|
||||
});
|
||||
|
||||
@@ -3,54 +3,55 @@ import * as robot from 'robotjs';
|
||||
import { Application } from 'spectron';
|
||||
|
||||
import {
|
||||
getDemoFilePath, loadURL,
|
||||
sleep,
|
||||
startApplication,
|
||||
stopApplication,
|
||||
Timeouts,
|
||||
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);
|
||||
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());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
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 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);
|
||||
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 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);
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -3,66 +3,67 @@ import * as robot from 'robotjs';
|
||||
import { Application } from 'spectron';
|
||||
|
||||
import {
|
||||
getDemoFilePath, loadURL,
|
||||
sleep,
|
||||
startApplication,
|
||||
stopApplication,
|
||||
Timeouts,
|
||||
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);
|
||||
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());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('screen-sharing-indicator: verify screen sharing indicator with frame is shown', async (t) => {
|
||||
await loadURL(app, getDemoFilePath());
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
await openScreenPicker(app);
|
||||
robot.setKeyboardDelay(2000);
|
||||
await loadURL(app, getDemoFilePath());
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
await openScreenPicker(app);
|
||||
robot.setKeyboardDelay(2000);
|
||||
|
||||
await sleep(Timeouts.halfSec);
|
||||
t.is(await app.client.getWindowCount(), 2);
|
||||
await app.client.windowByIndex(1);
|
||||
// will select the entire screen option in the picker
|
||||
robot.keyTap('right');
|
||||
robot.keyTap('left');
|
||||
robot.keyTap('enter');
|
||||
await sleep(Timeouts.halfSec);
|
||||
t.is(await app.client.getWindowCount(), 2);
|
||||
await app.client.windowByIndex(1);
|
||||
// will select the entire screen option in the picker
|
||||
robot.keyTap('right');
|
||||
robot.keyTap('left');
|
||||
robot.keyTap('enter');
|
||||
|
||||
await sleep(2000);
|
||||
t.is(await app.client.getWindowCount(), 2);
|
||||
await sleep(2000);
|
||||
t.is(await app.client.getWindowCount(), 2);
|
||||
});
|
||||
|
||||
test('screen-sharing-indicator: verify screen sharing indicator title', async (t) => {
|
||||
// including the screen sharing frame
|
||||
// including the screen sharing frame
|
||||
await app.client.windowByIndex(1);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
|
||||
const indicatorTitle = await app.browserWindow.getTitle();
|
||||
if (indicatorTitle !== 'Screen Sharing Indicator - Symphony') {
|
||||
await app.client.windowByIndex(1);
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
}
|
||||
|
||||
const indicatorTitle = await app.browserWindow.getTitle();
|
||||
if (indicatorTitle !== 'Screen Sharing Indicator - Symphony') {
|
||||
await app.client.windowByIndex(1);
|
||||
}
|
||||
|
||||
await app.client.click('.stop-sharing-button');
|
||||
await app.client.windowByIndex(0);
|
||||
await sleep(Timeouts.halfSec);
|
||||
// verify both frame and indicator are closed
|
||||
// when stop button is clicked
|
||||
t.is(await app.client.getWindowCount(), 1);
|
||||
await app.client.click('.stop-sharing-button');
|
||||
await app.client.windowByIndex(0);
|
||||
await sleep(Timeouts.halfSec);
|
||||
// verify both frame and indicator are closed
|
||||
// when stop button is clicked
|
||||
t.is(await app.client.getWindowCount(), 1);
|
||||
});
|
||||
|
||||
@@ -3,35 +3,41 @@ import * as robot from 'robotjs';
|
||||
|
||||
import { Application } from 'spectron';
|
||||
|
||||
import { getDemoFilePath, loadURL, startApplication, stopApplication, Timeouts } from './fixtures/spectron-setup';
|
||||
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());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('spell-checker: verify application spell checking feature', async (t) => {
|
||||
robot.setKeyboardDelay(Timeouts.oneSec);
|
||||
const missSpelledWord = 'teest ';
|
||||
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);
|
||||
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);
|
||||
t.is(await app.client.getValue('#tag'), missSpelledWord);
|
||||
|
||||
await app.client.rightClick('#tag', 10, 10);
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('enter');
|
||||
await app.client.rightClick('#tag', 10, 10);
|
||||
robot.keyTap('down');
|
||||
robot.keyTap('enter');
|
||||
|
||||
t.not(await app.client.getValue('#tag'), missSpelledWord);
|
||||
t.not(await app.client.getValue('#tag'), missSpelledWord);
|
||||
});
|
||||
|
||||
@@ -3,40 +3,41 @@ import { Application } from 'spectron';
|
||||
import { robotActions } from './fixtures/robot-actions';
|
||||
|
||||
import {
|
||||
getDemoFilePath, loadURL,
|
||||
sleep,
|
||||
startApplication,
|
||||
stopApplication,
|
||||
Timeouts,
|
||||
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());
|
||||
app = (await startApplication()) as Application;
|
||||
t.true(app.isRunning());
|
||||
});
|
||||
|
||||
test.after.always(async () => {
|
||||
await stopApplication(app);
|
||||
await stopApplication(app);
|
||||
});
|
||||
|
||||
test('zoom: verify application zoom feature', async (t) => {
|
||||
await loadURL(app, getDemoFilePath());
|
||||
await app.client.waitUntilWindowLoaded(Timeouts.fiveSec);
|
||||
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(), 0.5);
|
||||
await sleep(Timeouts.oneSec);
|
||||
|
||||
robotActions.zoomIn();
|
||||
t.is(await app.webContents.getZoomLevel(), 1);
|
||||
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.zoomOut();
|
||||
t.is(await app.webContents.getZoomLevel(), 0.5);
|
||||
await sleep(Timeouts.oneSec);
|
||||
|
||||
robotActions.zoomReset();
|
||||
t.is(await app.webContents.getZoomLevel(), 0);
|
||||
robotActions.zoomReset();
|
||||
t.is(await app.webContents.getZoomLevel(), 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user