CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/electron-playwright

Authors Playwright `_electron` tests for packaged Electron desktop apps - launches the app via `electron.launch({ args })`, returns an `ElectronApplication` handle, drives renderer windows as Playwright `Page` objects, and probes the main process via `electronApp.evaluate(({ app, BrowserWindow }) => …)`. Distinct from ordinary browser page automation: this wraps the `_electron` API for launching packaged Electron apps and probing main + renderer processes. Use for end-to-end tests of Electron apps where main-process state, IPC, and renderer DOM must all be asserted from one suite.

74

Quality

93%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

electron-ci-and-api.mdreferences/

electron-playwright - ElectronApplication API and CI

Full ElectronApplication API detail and the cross-OS CI workflow, kept out of the SKILL spine. See SKILL.md for the core launch-and-assert flow.

Sources: Playwright _electron launch reference and ElectronApplication API.

ElectronApplication API

MemberBehaviour
electron.launch({ args, executablePath, env, cwd, recordVideo, recordHar, timeout })Launches Electron; executablePath defaults to node_modules/.bin/electron (pwelectron).
electronApp.evaluate(fn)Runs fn in the main process; its first argument is the result of require('electron'), and a returned Promise is awaited (pwelectronapp).
electronApp.firstWindow()Waits for the first window and returns a Playwright Page (pwelectronapp).
electronApp.browserWindow(page)Returns the BrowserWindow JSHandle for a page (pwelectronapp).
electronApp.windows()Returns all opened windows (pwelectronapp).

Events (pwelectronapp):

  • 'window' - fires for every window created and loaded; payload is a Page.
  • 'console' - fires when the main process calls console methods; payload is a ConsoleMessage.
  • 'close' - fires when the application process terminates.

Supported Electron versions: v12.2.0+, v13.4.0+, and v14+ (pwelectron).

Cross-OS CI workflow

Linux runners need Xvfb (or another virtual framebuffer) because Electron requires a display server; xvfb-run is the standard wrapper. macOS and Windows GitHub-hosted runners are display-capable out of the box.

# .github/workflows/electron-e2e.yml
jobs:
  test:
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with: { node-version: '22' }
      - run: npm ci
      - run: npm run build:electron
      # On Linux, headless Electron needs a virtual display
      - name: Run E2E (Linux with Xvfb)
        if: runner.os == 'Linux'
        run: xvfb-run --auto-servernum npx playwright test --config=playwright.electron.config.ts
      - name: Run E2E (Windows/macOS)
        if: runner.os != 'Linux'
        run: npx playwright test --config=playwright.electron.config.ts
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: playwright-report-${{ matrix.os }}
          path: playwright-report/

SKILL.md

tile.json