Skip to content

Instantly share code, notes, and snippets.

@el3um4s
Created October 29, 2021 14:31
Show Gist options
  • Save el3um4s/d16111e7d2112963f38dba7ca76c3577 to your computer and use it in GitHub Desktop.
Save el3um4s/d16111e7d2112963f38dba7ca76c3577 to your computer and use it in GitHub Desktop.
MEDIUM - Ho to Test Electron Apps - 14
let context: BrowserContext;
test.beforeAll(async () => {
electronApp = await electron.launch({ args: ["."] });
context = electronApp.context();
await context.tracing.start({ screenshots: true, snapshots: true });
firstWindow = await electronApp.firstWindow();
await firstWindow.screenshot({ path: "tests/screenshot/firstWindow.png" });
expect(await firstWindow.screenshot()).toMatchSnapshot("firstWindow.png");
});
// ...
test.afterAll(async () => {
await context.tracing.stop({ path: "tests/tracing/trace.zip" });
await electronApp.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment