Skip to content

jeremymreed/electron-playwright-example

 
 

Repository files navigation

electron-playwright-example

Example of multi-window Playwright testing with Electron

git clone https://github.com/spaceagetv/electron-playwright-example.git
cd electron-playwright-example
npm install
npm run e2e

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

About

Example of multi-window Playwright testing with Electron

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 90.5%
  • JavaScript 7.5%
  • HTML 1.2%
  • CSS 0.8%