Last active
October 21, 2021 00:19
-
-
Save UberMouse/facbe751c3ecb9b31e8b4f6221567b7a to your computer and use it in GitHub Desktop.
Revisions
-
UberMouse revised this gist
Oct 21, 2021 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,8 +27,6 @@ export const electronFixtures: Fixtures<ElectronTestFixtures> = { const context = electronApp.context(); await run(context); }, }; -
UberMouse created this gist
Oct 20, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ import type { Fixtures } from "@playwright/test"; import { test as base } from "@playwright/test"; import { BrowserContext, ElectronApplication, Page } from "playwright"; export { expect } from "@playwright/test"; type ElectronTestFixtures = { electronApp: ElectronApplication; page: Page; context: BrowserContext; }; export const electronFixtures: Fixtures<ElectronTestFixtures> = { electronApp: async ({}, run) => { // This env prevents 'Electron Security Policy' console message. process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true"; const electronApp = await aFunctionThatCallsElectronLaunchProcess(); await run(electronApp); await electronApp.close(); }, page: async ({ electronApp }, run) => { const page = await electronApp.firstWindow(); await run(page); }, context: async ({ electronApp }, run) => { const context = electronApp.context(); await run(context); await context.close(); }, }; // @ts-ignore some error about a string type now having `undefined` as part of it's union export const electronTest = base.extend<ElectronTestFixtures>(electronFixtures); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ import type { PlaywrightTestConfig } from '@playwright/test'; import * as path from 'path'; const outputDir = path.join(__dirname, 'test-results'); const config: PlaywrightTestConfig = { outputDir, timeout: 30000, globalTimeout: 5400000, workers: process.env.CI ? 1 : undefined, forbidOnly: !!process.env.CI, preserveOutput: process.env.CI ? 'failures-only' : 'always', retries: process.env.CI ? 3 : 1, reporter: process.env.CI ? [ [ 'dot' ], [ 'json', { outputFile: path.join(outputDir, 'report.json') } ], ] : 'line', projects: [{ name: 'chromium', use: { browserName: 'chromium', trace: process.env.CI ? 'on-first-retry' : 'on' }, metadata: { platform: process.platform, headful: true, browserName: 'electron', channel: undefined, mode: 'default', video: false, } }], }; export default config;