Repository navigation
feat(playwright): support Electron apps - #407
Merged
Merged
Conversation
`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>
…on-apps-playwright-3c7d68
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes ARG-514.
argosScreenshotandargosAriaSnapshotnow work on a window launched with Playwright's_electron.launch(). Before this change they threwSnapshots can't be taken without a viewport., and thenCan't take screenshots without a browser.page.viewportSize()is null, the SDK readswindow.innerWidth/innerHeightfrom the page. This also makesviewport: nullcontexts work in regular browsers.context().browser()is null (Playwright's types say that only happens for Electron and Android), the SDK readsElectron/<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 asv{version}, and an Android context would otherwise be labeled Electron.viewportsoption. It now throws on pages without a viewport. CallingsetViewportSizeon 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.viewportschecks run. Both checks (iframe and no viewport) now run with the other argument checks, before the capture index,prepareandbeforeAll. 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
enhancementChecklist
Optional checks:
Further comments
viewport: null: one checks the metadata viewport, the other checks theviewportserror. CI doesn't run Electron itself, since that would need Electron and xvfb on Linux.900×618, browserelectron/38.8.6. With a custom user agent there's nobrowserfield. Full-page captures and ARIA snapshots work.argos uploadworkaround in the Playwright FAQ. It should merge after this ships.@argos-ci/puppeteerhas the same failure withdefaultViewport: null, which is a separate change. The reporter's warning about missinglaunchOptionsargs also shows for Electron projects, where those options don't apply.🤖 Generated with Claude Code