Skip to content

feat(playwright): support Electron apps - #407

Merged
gregberge merged 2 commits into
mainfrom
claude/arg-514-electron-apps-playwright-3c7d68
Oct 21, 2026
Merged

gregberge merged 2 commits into
mainfrom
claude/arg-514-electron-apps-playwright-3c7d68

Conversation

@gregberge

Copy link
Copy Markdown
Member

Description

Fixes ARG-514. argosScreenshot and argosAriaSnapshot now work on a window launched with Playwright's _electron.launch(). Before this change they threw Snapshots can't be taken without a viewport., and then Can't take screenshots without a browser.

  • Viewport. When page.viewportSize() is null, the SDK reads window.innerWidth/innerHeight from the page. This also makes viewport: null contexts work in regular browsers.
  • Browser. When context().browser() is null (Playwright's types say that only happens for Electron and Android), the SDK reads Electron/<version> from the user agent and records { name: "electron", version }. The Argos app already has an Electron label and icon. If the app replaced its user agent, the SDK records no browser instead of guessing: the API requires a version string, the UI renders it as v{version}, and an Android context would otherwise be labeled Electron.
  • viewports option. It now throws on pages without a viewport. Calling setViewportSize on an Electron window can't be undone, and Playwright has no public API to clear it. On Electron 38.8.6, a 2× window stayed at 1× afterwards and ignored a later window resize.
  • Where the viewports checks run. Both checks (iframe and no viewport) now run with the other argument checks, before the capture index, prepare and beforeAll. A rejected call no longer leaves the page stabilized or uses up a capture index. This also changes the existing iframe error, which previously fired after those steps.

Type of changes

enhancement

Checklist

  • I have read the CONTRIBUTING doc (the repo has none)
  • The commits message follows the Conventional Commits' policy
  • Lint and unit tests pass locally
  • I have added tests if needed

Optional checks:

Further comments

  • Tests. Unit tests cover the browser detection. Two e2e tests run Chromium with viewport: null: one checks the metadata viewport, the other checks the viewports error. CI doesn't run Electron itself, since that would need Electron and xvfb on Linux.
  • Manual check. I ran it against a real Electron 38.8.6 app, from a plain script and through the Playwright test runner with the Argos reporter. Metadata: viewport 900×618, browser electron / 38.8.6. With a custom user agent there's no browser field. Full-page captures and ARIA snapshots work.
  • Docs. docs(playwright): document taking screenshots of Electron apps docs#265 replaces the argos upload workaround in the Playwright FAQ. It should merge after this ships.
  • Not covered here. @argos-ci/puppeteer has the same failure with defaultViewport: null, which is a separate change. The reporter's warning about missing launchOptions args also shows for Electron projects, where those options don't apply.

🤖 Generated with Claude Code

gregberge and others added 2 commits October 21, 2026 14:29
`argosScreenshot` and `argosAriaSnapshot` threw on a window launched with
`_electron.launch()`: Electron contexts have no viewport and no browser.

- Without a viewport, read the window's inner size from the page.
- Without a browser, record `electron` with the version from the user
  agent, or no browser when the app replaced its user agent.
- Reject the `viewports` option on pages without a viewport, before
  touching the page: setting a viewport on an Electron window can't be
  undone (it drops to a device scale factor of 1 and stops following
  its window).

The `viewports` checks now run with the other argument checks, so a
rejected call no longer leaves the page stabilized or uses up a capture
index.

Refs ARG-514

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregberge gregberge added the enhancement New feature or request label Oct 21, 2026
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
argos-js-sdk-reference Ready Ready Preview Oct 21, 2026 12:31pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

ARG-514

@gregberge
gregberge merged commit 78dfbce into main Oct 21, 2026
79 checks passed
@gregberge
gregberge deleted the claude/arg-514-electron-apps-playwright-3c7d68 branch October 21, 2026 12:35

This branch was successfully deployed

1 active deployment
Preview — cab6ff5f Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant