CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

testland/electron-playwright

Use whenever an Electron desktop app needs end-to-end tests, or a Spectron suite must be migrated: Playwright's _electron.launch, renderer windows as Pages, main-process checks via electronApp.evaluate, and IPC and DOM assertions from one suite.

Quality

86%

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