Ability to "mask" areas of the application so visual regression will not be compared against certain parts of the page.
See original GitHub issueMode
Page screenshots
Feature description
Use case: If my website has an image carousel and the image content changes routinely or at random, I may want to disregard differences in this section of the website.
Potential solution: A configuration that allows identifiers to be declared for DOM nodes (class, ID, attributes) and sets the CSS property of Visibility with the value of None. Alternatively, if the comparison tool is capable, ignore differences that occur inside certain dom nodes.
This will make specified dom nodes invisible and therefore these elements will not cause false failures in visual regression testing.
Example configuration:
export const config: CustomProjectConfig = {
pageShots: {
pages: [
{ id: "capocaccia.dev/posts/uses", path: "/posts/uses", name: "Uses", ignore: ['data-testid="post-cover-image"'] },
{ id: "capocaccia.dev/", path: "/", name: "Home" },
],
pageUrl: "http://172.17.0.1:3000",
}
};
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5
Top Results From Across the Web
[Feature] Ability to add mask when comparing snapshot images
For example let's say my page always displays a date somewhere on the screen. An image would always see that date as a...
Read more >Visual regression testing with Playwright - Qxperts
Read on and start coding to do visual regression testing with Playwright. ... in your web application) you can ignore specific sections.
Read more >Visual Regression Testing. what, why and how - Medium
Essentially, visual regression tests allows us to understand the changes that will be perceived by our users through screenshots and content ...
Read more >Visual regression testing and AI: What, why and how? - Ericsson
Visual regression testing, also called user interface (UI) testing, is the process of verifying the aesthetic accuracy of everything end-users ...
Read more >Visual Regression Testing - Base Web
This is where the visual in "visual snapshot testing" comes from. We use images as our snapshots and compare those images across test...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just completed implementing the masks feature.
You can see an example in this shot:
I only provided this mask selector to the page in my list:
mask: [{ selector: 'h2' }],
This was enough to mask all
H2
elements found on that page.You can now define for each page a
mask
list https://github.com/lost-pixel/lost-pixel/blob/feature/shot-mask/src/config.ts#L227Here are some CSS selector examples: Examples:
#my-id
: Selects the element with the idmy-id
.my-class
: Selects all elements with the classmy-class
div
: Selects alldiv
elementsdiv.my-class
: Selects alldiv
elements with the classmy-class
li:nth-child(2n)
: Selects all evenli
elements[data-testid="hero-banner"]
: Selects all elements with the attributedata-testid
set tohero-banner
div > p
: Selects allp
elements that are direct children of adiv
elementIn your case the config would look like this:
(I also dropped the
id
props as they are now obsolete. Thename
prop defines the uniqueness )Please upgrade to version
2.20.0
and let me know how it went.This is an absurd turn around time. Ill upgrade to 2.20.0 and provide feedback.