How to Mask Changing Dates in Applitools Visual Tests
Mask dates that change between runs in Applitools Eyes, while keeping the visual coverage and functional checks your test needs.
In Applitools Eyes, mark the date element as an ignored region when its changing value and local appearance do not matter to the visual assertion. In the official Playwright integration, pass a locator in ignoreRegions to eyes.check(). Keep the region tight: Eyes will not compare anything inside it, so an overly broad mask can hide a real visual defect.
If the date should remain visible and its surrounding presentation still matters, consider Dynamic matching instead. If correctness depends on the actual date value, assert that value separately in the test; visual tolerance does not verify semantic correctness.
Mask a date with Playwright
Use a stable locator for the date element in your application. The selector below is an example; replace it with the selector your page actually exposes.
await eyes.check('Homepage', {
fully: true,
matchLevel: 'Strict',
ignoreRegions: [page.locator('[data-testid="last-updated"]')],
});
This uses the documented Playwright API shape for ignoring dynamic content. The example does not mean that selector exists on your page. Confirm the current syntax for your Eyes SDK and version before transferring it to another integration, such as Selenium or Java. See the Applitools documentation for the relevant SDK reference.
Keep the ignored region narrow
- Find the smallest DOM element that contains the changing date.
- Use a locator that consistently identifies that element across test runs.
- Ignore only that element, rather than a whole card, page section, or large container.
- Review a resulting visual diff to confirm nearby labels, spacing, borders, icons, and layout remain covered.
An ignored region suppresses visual differences within its bounds. If a date is inside a larger container, masking the container can conceal unrelated regressions in that area.
Choose between Ignore, Dynamic, Layout, and Strict
| Approach | What remains checked | Best fit | Tradeoff |
|---|---|---|---|
| Narrow Ignore region | Everything outside the ignored bounds | The date and its local appearance are irrelevant to this visual check | A defect wholly inside the region is invisible to visual comparison |
| Dynamic region or Dynamic Match Level | Other visual content remains subject to comparison while recognized patterns can vary, depending on product and SDK behavior | The date changes, but its presence and broader appearance should still matter | Pattern recognition may not cover a custom format or locale; confirm support and behavior |
| Layout Match Level | Structure and relative positioning | Many strings vary, but page structure is the main target | Content differences across the checked area may be missed |
| Strict | Text, graphics, colors, and positioning, subject to Eyes matching behavior | Static content or a checkpoint where the date should stay stable | An expected date change can create a visual difference |
Applitools documents Strict as checking human-noticeable changes in text, font, color, graphics, and position. Ignore Colors retains Strict-like checks while allowing color variation. Layout emphasizes element positions while ignoring content differences. Exact comparison is pixel-to-pixel and unusually sensitive; Applitools does not recommend it for ordinary verification. Availability and names can vary across products and SDKs, so check the reference for your integration.
When Dynamic is a better fit
Applitools describes Dynamic regions as a way to tolerate predictable patterns such as timestamps and IDs while still aiming to catch other issues. Its product notes describe Dynamic Match Level as recognizing predefined patterns, including dates, and supporting custom regular expressions. Do not assume every format will be recognized: locale, separators, and application-specific date strings can affect whether a pattern applies. Verify the behavior with your SDK and test configuration.
Applitools’ June 8, 2026 product note says Dynamic Match Level became the default for new Eyes tests. That does not establish that existing tests were automatically switched. Check the setting in an existing test rather than inferring it from the current default for newly created tests.
When Layout is too broad
Layout can be useful when text and graphics vary broadly but relative structure matters. For one changing date, it is usually a wider concession than a targeted ignored region: meaningful text or graphic changes elsewhere may no longer be detected. Choose it only when that broader comparison matches the test’s purpose.
Keep functional date checks separate
If the date must equal a value derived from test input, keep a functional assertion for that requirement even when the visual comparison tolerates the changing text. For example, assert the underlying date value through your application’s accessible or data interface, then use the visual checkpoint to check the surrounding page.
The right division is straightforward: functional assertions verify that the date is correct; visual matching verifies the parts of the rendered page that should remain visually consistent. A mask alone cannot establish that the date is semantically right.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The date still causes a visual difference | The locator does not match the rendered date element, or the ignored bounds do not cover it | Confirm the locator resolves on the page at checkpoint time and targets the visible date element. Inspect the diff and adjust only as much as needed. |
| A nearby layout change is no longer detected | The ignored region covers a parent container or other content along with the date | Narrow the locator to the smallest date element and review the new diff. |
| A Dynamic rule does not recognize the date | The date format or locale is not among the patterns recognized in the current setup | Check current SDK pattern support; where available, define and verify a custom regular expression. Do not rely on an unverified pattern. |
| The mask syntax fails after copying a Playwright example to another SDK | Integration APIs differ | Use the documentation for the SDK in the project; the locator example here is Playwright-specific. |
| A date is visually tolerated but incorrect | The test relies on visual comparison to establish application correctness | Add or retain a functional assertion for the expected date value. |
| An expected change still causes a diff in an older test | The test may not have the current Dynamic default or setting | Inspect the existing test’s configuration and set the intended match behavior explicitly if needed. |
Performance, reliability, and maintenance
A targeted ignored region changes what Eyes compares; it does not make a flaky selector reliable by itself. Prefer a stable locator tied to the date element, and make sure the element is present before the checkpoint. If the DOM structure changes, revisit the locator and confirm the ignored area still matches the intended element.
Dynamic matching avoids masking an entire region, but it depends on pattern support and the configuration used by that test. For a nonstandard date representation, validate the rule against representative values and locales. With any approach, review changes to the checkpoint and keep the scope aligned with what the test is meant to protect.
There is no universal performance or cost figure for this configuration in the cited documentation. The practical reliability cost is coverage: broader tolerance can reduce noisy diffs, but also makes more changes invisible. Keep the tolerated area or pattern as narrow as the test goal allows.
Or skip the browser setup
If you also need clean screenshots outside your Eyes checkpoint, ScreenshotNeo is a website screenshot API and MCP server for developers. Its API returns a screenshot or PDF from one GET request. The ScreenshotNeo API documentation lists its parameters and options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off.
- Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Response headers identify the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents and MCP clients. - The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; all features are on every plan.
Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.
FAQ
Does masking a date verify its value?
No. An ignored region suppresses visual comparison inside its bounds. Use a functional assertion when the date’s actual value matters.
Should I mask the whole date container?
Only if the entire container is irrelevant to the visual test. Otherwise, target the smallest element containing the changing value.
Will Dynamic matching recognize every date?
There is no guarantee for every locale or custom format. Check the current SDK’s supported patterns and verify any custom rule in the test environment.
Does the June 2026 default apply to my existing test?
The product note describes the default for new Eyes tests. Inspect the configuration of an existing test directly.


