Repository navigation
feat: hide, remove and mask regions from every SDK - #403
Merged
gregberge merged 8 commits intoOct 21, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 21, 2026
Passing `mask` to `argosScreenshot` replaced the mask applied to `[data-visual-test="blackout"]` elements instead of adding to it, so those elements were no longer masked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hide or remove elements straight from `argosScreenshot`, without adding `data-visual-test` attributes to the application. The options apply the `transparent` and `removed` Argos helpers to the matched elements during the screenshot and restore them afterwards. - Playwright: `Locator`s or Playwright selectors (also used by the Vitest plugin options and Storybook). - Puppeteer: `ElementHandle`s or Puppeteer selectors. - Cypress: selectors. - Vitest: selectors, in the per-call options. Selectors that match nothing are ignored. When an element is both hidden and removed, it is removed. Refs ARG-520 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Keep the strongest helper in `applyHelper` (removed over transparent) instead of relying on call order in every SDK, so each SDK applies all targets in one batch. - Restore attributes from the `argosHelpers` core plugin `beforeEach` cleanup instead of a wrapper registering it by hand. - Apply the helpers before `beforeEach`, so plugins measuring the layout see it as with the `data-visual-test` attributes. - Share the Puppeteer in-page callback, skip the Cypress command when there is nothing to apply, and drop the redundant Playwright `mask` type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gregberge
force-pushed
the
greg/arg-520-ignore-regions-in-screenshot-comparisons
branch
from
October 21, 2026 08:16
cd9b9f3 to
8d11d98
Compare
jsfez
approved these changes
Oct 21, 2026
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>
Bring the WebdriverIO SDK to parity with the other SDKs for hiding regions. `argosScreenshot` now injects the Argos browser script and runs its core plugins only (`__argos__` class, `argosCSS`, `data-visual-test` helpers), so no stabilization waits are added. The page is restored after the screenshot. - `hide` and `remove` take WebdriverIO selectors and apply the `transparent` and `removed` helpers to the matched elements. Removing wins over hiding. - `mask` also takes selectors. Their areas are measured in the viewport, which is what `saveScreenshot` captures, and scaled by the device pixel ratio. Elements with `data-visual-test="blackout"` are always masked, as with Playwright and Cypress. Areas are clipped to the screenshot. - `argosCSS` injects custom CSS during the screenshot. Existing `data-visual-test` attributes now take effect, so screenshots of pages using them will change. The e2e runner resolves the built `@argos-ci/*` packages, as the browser script is only embedded at build time. Refs ARG-520 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lback - Remove the mask boxes from the `argosHelpers` core plugin `beforeEach` cleanup, like the helpers, instead of registering the cleanup by hand. - Share the Puppeteer in-page mask callback between selectors and element handles, like `applyHelpers` does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`mask` now takes string selectors as well as `Locator`s in the Playwright SDK, like `hide`, `remove` and `element`, and like `mask` in the Puppeteer and WebdriverIO SDKs. Vitest gets `mask` and `maskColor` in its per-call options, so a browser test can mask elements too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hide and remove screenshot options`argosScreenshot` now injects the Argos script to apply the helpers, which fails in an Appium native app context where no script can run. Detect it (`isNativeContext`, or `getContext()` before WebdriverIO 9) and capture the screen as is, with rectangle masks. The options needing a web page throw a clear error there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gregberge
deleted the
greg/arg-520-ignore-regions-in-screenshot-comparisons
branch
October 21, 2026 12:26
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
Part of ARG-520. You can now hide, remove or mask dynamic elements straight from
argosScreenshot, without addingdata-visual-testattributes to the application, in every SDK:hide/removemask(+maskColor)data-visual-testhelpersLocatorsLocators (native option, extended)ElementHandlesElementHandles (new: overlay boxes)blackoutnewblackout(selectors)How it works:
hide/remove: a new browser global,__ARGOS__.applyHelper(elements, helper), sets thedata-visual-testattribute on the elements each SDK resolved with its own selector engine. TheargosHelperscore plugin'sbeforeEachcleanup restores the original values, including an existingdata-visual-test="blackout". Helpers are applied beforebeforeEach, so plugins that measure layout see the same page as with markup attributes. They are applied again for each viewport. When an element is both hidden and removed,removewins, whatever the call order.maskin Puppeteer, which has no native mask:__ARGOS__.mask(elements, color)draws a top-layer overlay that follows the elements. It works for full-page and element screenshots and above modal dialogs, and the same cleanup removes it.data-visual-testhelpers andargosCSSnow apply there. Masks are composited onto the PNG with sharp, using element rects scaled bydevicePixelRatio. In an Appium native-app context, where no script can run, it captures the screen as before (rectangle masks only), and the options that need a page throw a clear error.Behavior changes:
maskused to replace the mask on[data-visual-test="blackout"]elements; it now adds to it (fix(playwright)commit). The same Cypressblackoutbug was fixed onmainin f72211e.data-visual-testattributes will change, because the helpers now apply.Type of changes
enhancementChecklist
Optional checks:
hide,removeandmaskscreenshot options docs#264, to merge after the release)Further comments
Tests. Every SDK has e2e tests that check pixels in the captured PNGs, or attributes for Cypress, during and after the screenshot. They cover hide, remove, precedence, restoring the page, the merged blackout mask,
maskColor, and for Puppeteer full-page, element and modal-dialog masks. Locally: Playwright 28, Puppeteer 17, Cypress 9, WebdriverIO 9 and Vitest 21 pass, plus types, lint, format and unit tests for the seven packages.Merging. Prefer Rebase and merge. Each commit is a conventional commit scoped to its packages (
fix(playwright),feat(puppeteer),feat(webdriverio), …), so the changelogs list each change. A squash would collapse them into one entry.Not covered: the wider ARG-520 idea of diff-time ignore regions (stored in metadata or set in the review UI) is backend and app work, so the issue stays open.
🤖 Generated with Claude Code