2020-08-10 23:04:38 -07:00
|
|
|
import '../base.fixture';
|
|
|
|
import {ElectronApplication, ElectronLauncher, ElectronPage} from '../../electron-types';
|
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
const electronName = process.platform === 'win32' ? 'electron.cmd' : 'electron';
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface FixtureState {
|
|
|
|
application: ElectronApplication;
|
|
|
|
window: ElectronPage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '../../index' {
|
|
|
|
const electron: ElectronLauncher
|
|
|
|
}
|
|
|
|
|
|
|
|
registerFixture('application', async ({playwright}, test) => {
|
|
|
|
const electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', electronName);
|
|
|
|
const application = await playwright.electron.launch(electronPath, {
|
|
|
|
args: [path.join(__dirname, 'testApp.js')],
|
|
|
|
});
|
2020-08-12 17:51:07 -07:00
|
|
|
await test(application);
|
|
|
|
await application.close();
|
2020-08-10 23:04:38 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
registerFixture('window', async ({application}, test) => {
|
|
|
|
const page = await application.newBrowserWindow({ width: 800, height: 600 });
|
2020-08-12 17:51:07 -07:00
|
|
|
await test(page);
|
|
|
|
await page.close();
|
2020-08-10 23:04:38 -07:00
|
|
|
});
|