Repository navigation
feat(puppeteer): support the blackout helper and add mask option - #404
Merged
gregberge merged 1 commit intoOct 21, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
gregberge
force-pushed
the
greg/arg-520-ignore-regions-in-screenshot-comparisons
branch
from
October 21, 2026 08:16
cd9b9f3 to
8d11d98
Compare
Puppeteer has no native mask, so `[data-visual-test="blackout"]` was silently ignored. Cover masked elements with boxes drawn by the browser script, like Playwright does: a glass pane in the top layer (above modal dialogs) whose boxes follow the elements until the screenshot is taken, since Puppeteer scrolls the element into view for element screenshots. The boxes are applied once the page is stable and removed by `afterEach`. `mask` accepts selectors or `ElementHandle`s, and `maskColor` defaults to Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gregberge
force-pushed
the
greg/puppeteer-mask
branch
from
October 21, 2026 08:19
8ad3432 to
7d03fce
Compare
gregberge
merged commit Oct 21, 2026
29bbd24
into
greg/arg-520-ignore-regions-in-screenshot-comparisons
2 checks passed
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.
Stacked on #403 (ARG-520).
Why
Puppeteer has no native mask, so
[data-visual-test="blackout"]was silently ignored by@argos-ci/puppeteer(the docs say blackout is "Storybook, Playwright, and Cypress SDKs only"). Playwright hasmaskand Cypress hasblackout; Puppeteer had nothing.What
@argos-ci/browser: new__ARGOS__.mask(elements, color), undone byafterEach(). It draws a box over each element, the way Playwright's ownmaskworks:popover="manual"so it sits in the top layer, above modal dialogs and popovers;getBoundingClientRect();requestAnimationFrameloop that keeps the boxes on their elements until cleanup. Puppeteer scrolls the element into view insideElementHandle.screenshot(), after we measure, and resizes the viewport forfullPage+captureBeyondViewport: false.@argos-ci/puppeteer: newmaskoption ((string | ElementHandle)[]) andmaskColoroption (default#FF00FF, same as Playwright and the WebdriverIO SDK).[data-visual-test="blackout"]is always masked. The mask is applied after the last stabilization wait, right before capture, so the boxes match the final layout.The browser function is generic, so other SDKs without a native mask can reuse it.
Tests
Pixel-level tests in
packages/puppeteer/test.spec.jsdecode the PNG in the page with a canvas:maskselectors and handles, with exact box edges, and the overlay is removed afterwards;maskColor;<dialog>(fails without the popover).pnpm exec turbo run check-types lint check-format --filter=@argos-ci/puppeteer --filter=@argos-ci/browserpasses, and all 17 Puppeteer tests pass locally.Follow-ups
mask/maskColorin the Puppeteer reference, once this ships.🤖 Generated with Claude Code