Skip to content

docs: document hide, remove and mask screenshot options - #264

Merged
gregberge merged 4 commits into
mainfrom
docs/sdk-hide-remove-options
Oct 21, 2026
Merged

gregberge merged 4 commits into
mainfrom
docs/sdk-hide-remove-options

Conversation

@gregberge

@gregberge gregberge commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Documents the hide, remove and mask options of argosScreenshot from argos-ci/argos-javascript#403 (ARG-520), which now covers every SDK. They let you hide, remove or mask dynamic elements from the test, without adding data-visual-test attributes to the app.

Important

Merge only after the SDK release that includes argos-ci/argos-javascript#403. #403 is merged on main (4609e4a..5712957) but not released yet: npm still has playwright 7.7.1, puppeteer 6.1.11, cypress 7.2.4, webdriverio 0.9.0, vitest 0.8.0 and storybook 6.4.2.

Changes

  • Playwright: options.hide and options.remove (Locators or string selectors), options.mask (now also string selectors) and options.maskColor in the argosScreenshot options, plus an example in "Helper Attributes for Visual Testing". "Mask elements" now says mask adds to the [data-visual-test="blackout"] elements, so I removed the workaround of re-adding the blackout locator yourself.
  • Puppeteer: hide, remove and the new mask (string selectors or ElementHandles) and maskColor. data-visual-test="blackout" is now listed in the helpers.
  • Cypress: hide and remove (selectors), and blackout, which now extends the [data-visual-test="blackout"] selector (fixed on argos-javascript main in f72211e, also unreleased).
  • WebdriverIO: hide, remove (WebdriverIO selectors), mask (now WebdriverIO selectors as well as rectangles; elements with data-visual-test="blackout" are always masked) and the new argosCSS. The hint saying the SDK captures as-is is replaced: the data-visual-test helpers and argosCSS now apply, but stabilization waits (loading, fonts, images, GIFs, scrollbars, carets) still don't. A new "Helper Attributes for Visual Testing" section matches the other SDKs, with a warning that screenshots of pages using data-visual-test attributes change after upgrading. In an Appium native app context, the screen is still captured as is: no helpers, rectangle masks only, and hide, remove, argosCSS or selector masks throw an error (5c5b175).
  • Vitest: hide, remove, mask (selectors) and maskColor in the per-call options. The plugin paragraph notes that a per-call list replaces the plugin's list instead of adding to it ({ ...pluginOptions, ...options }).
  • Argos helpers: blackout is no longer limited to some SDKs. A note says WebdriverIO applies transparent, removed, blackout and no-radius, but not the stabilization ones (wait-bg-img, GIF pausing). A new "Apply helpers from your tests" section maps transparent → hide, removed → remove, blackout → mask (blackout in Cypress), with a Playwright example and links to every SDK reference.

Checked against the merged code on argos-javascript main (5712957, same tree as the #403 head 5c5b175). Behavior described everywhere: hide keeps the element's layout space, remove takes it out of the layout, selectors that match nothing are ignored, an element in both lists is removed, and the page is restored after the screenshot. The options are applied again for each viewport in the SDKs that support viewports.

Not changed

  • Storybook: the page links to the Playwright options instead of listing them, so it picks up the new options without changes.
  • The migration guides (from-lost-pixel.md, from-vitest-native-screenshots.md) still map mask to data-visual-test helpers or argosCSS. They could point to hide / mask in a follow-up.

🤖 Generated with Claude Code

Add the `hide` and `remove` options of `argosScreenshot` to the
Playwright, Puppeteer, Cypress and Vitest references, with examples next
to the helper attributes. `hide` works like `data-visual-test="transparent"`
and `remove` like `data-visual-test="removed"`.

Playwright `mask` and Cypress `blackout` now add to the elements with
`data-visual-test="blackout"` instead of replacing them, so drop the
workaround from the Playwright page.

The helpers page gets a section on applying helpers from the tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregberge
gregberge requested review from jsfez and a balanced review from Copilot October 21, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Upstream SDK PR #403 remains unmerged, so a maintainer must confirm the required release before merging these docs.

No open issues 🎉

What changed in this PR

Documents test-side screenshot helpers for hiding dynamic content without changing application markup.

Changes:

  • Adds hide and remove options and examples across SDK references.
  • Clarifies additive masking and Vitest per-call overrides.
  • Maps helper attributes to SDK options in the shared guide.
File Description
docs/​sdks-reference/​vitest.md Documents selectors and plugin-default overrides.
docs/​sdks-reference/​puppeteer.md Adds helper options and usage example.
docs/​sdks-reference/​playwright.md Adds helper options and clarifies additive masking.
docs/​sdks-reference/​cypress.md Documents helper options and additive blackout.
docs/​learn/​reliability-and-flakiness/​flaky-tests/​argos-helpers.md Maps attributes to test-side options and SDK references.

Review effort: Balanced

argos-javascript#403 now also covers Puppeteer masking, WebdriverIO
support and selectors in the Playwright and Vitest `mask` option.

- Puppeteer: `mask` and `maskColor`, and the `blackout` helper.
- WebdriverIO: `hide`, `remove`, `argosCSS`, selector masks, and the
  `data-visual-test` helpers, which now apply. Stabilization waits still
  don't run. Warn that screenshots of pages using the helpers change on
  upgrade.
- Playwright: `mask` accepts string selectors, `maskColor` listed.
- Vitest: per-call `mask` and `maskColor`.
- Helpers page: every SDK applies the helpers and has the options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregberge gregberge changed the title docs: document hide and remove screenshot options docs: document hide, remove and mask screenshot options Oct 21, 2026
gregberge and others added 2 commits October 21, 2026 11:10
In an Appium native app context there is no page to run the Argos
script in, so the helpers don't apply, `mask` only accepts rectangles,
and `hide`, `remove`, `argosCSS` or selector masks throw an error
(argos-javascript#403, 5c5b175).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gregberge
gregberge merged commit f28844b into main Oct 21, 2026
2 checks passed
@gregberge
gregberge deleted the docs/sdk-hide-remove-options branch October 21, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants