Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spaceagetv/electron-playwright-example
Example of multi-window Playwright testing with Electron
https://github.com/spaceagetv/electron-playwright-example
e2e electron playwright testing typescript
Last synced: 2 months ago
JSON representation
Example of multi-window Playwright testing with Electron
- Host: GitHub
- URL: https://github.com/spaceagetv/electron-playwright-example
- Owner: spaceagetv
- License: mit
- Created: 2021-10-13T03:00:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T20:16:04.000Z (almost 2 years ago)
- Last Synced: 2023-03-05T19:58:13.965Z (almost 2 years ago)
- Topics: e2e, electron, playwright, testing, typescript
- Language: TypeScript
- Homepage:
- Size: 808 KB
- Stars: 52
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-playwright-example
Example of multi-window [Playwright](https://playwright.dev) testing with [Electron](https://www.electronjs.org)
```shell
git clone https://github.com/spaceagetv/electron-playwright-example.git
cd electron-playwright-example
npm install
npm run e2e
```## 🚀 electron-playwright-helpers!!
The library of helper functions for this project has been broken out into its own NPM package,
which you can install in your own project and use when writing your own tests. Find the
**electron-playwright-helpers** library [on GitHub](https://github.com/spaceagetv/electron-playwright-helpers) and [NPM](https://www.npmjs.com/package/electron-playwright-helpers).## Notes
This example uses Electron Forge configured to build with Webpack. Since we're testing the .webpack code, this test does a `npm run package` to prepare the code before each `npm run e2e`.
Note also that `nodeIntegration` is enabled and `contextIsolation` is disabled when the `CI` environment variable is set to "1". This allows us to maintain recommended Electron security for our distributed app, while allowing us greater access while testing.
Find the tests in the `e2e-tests` directory.
**Tests:**
1. The first window is loaded
2. Button exists on the page
3. Clicking the button opens a new window
4. Check the title of the new window
5. Trigger an IPC listener directly in the main process
6. Send an IPC message from the renderer
7. Receive IPC invoke/handle via renderer
8. Click a menu item in the main process
9. Make sure two screenshots match one another