-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/exclude #303
Feature/exclude #303
Conversation
…t comparator, created new status conditionally passed
@@ -97,6 +127,13 @@ public void setParameters(Map<String, String> params) throws ParametersException | |||
.isNotBlank(params.get(CSS_PARAM))) { | |||
setElementParams(params); | |||
} | |||
if(params.containsKey(EXCLUDE_ELEMENT_PARAM)) { | |||
if (StringUtils.isNotBlank(params.get(EXCLUDE_ELEMENT_PARAM))) { | |||
namesOfExcludeElements = params.get("exclude-elements"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use constant also here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update CHANGELOG according to AET Contributing rules
mask = new ByteArrayInputStream(baos.toByteArray()); | ||
String maskArtifactId = artifactsDAO.saveArtifact(properties, mask, CONTENT_TYPE); | ||
|
||
if (isMaskWithoutDifference(imageComparisonResult) && !excludeFunctionIsOn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching those arguments will be more performant.
@@ -32,14 +32,22 @@ | |||
private static final long serialVersionUID = 7758484589529051815L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After updating Serializable
class, please update this property.
@@ -56,12 +62,27 @@ | |||
|
|||
private final CollectorProperties properties; | |||
|
|||
private String namesOfExcludeElements; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider changing the name of this field - it hold a CSS selector of elements to exclude, so maybe something like excludeCssSelector
?
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
public class Exclude implements Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the class name to something more meaningful - it should be a noun, not a verb
After merging #293 please change the target branch to |
@@ -55,14 +59,27 @@ | |||
|
|||
private Double percentageThreshold; | |||
|
|||
private boolean excludeFunctionIsOn = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to initialise boolean
with false
, its default value.
ScreenCollector(CollectorProperties properties, WebDriver webDriver, ArtifactsDAO artifactsDAO) { | ||
this.properties = properties; | ||
this.webDriver = webDriver; | ||
this.artifactsDAO = artifactsDAO; | ||
} | ||
|
||
private List<ExcludedElement> getExcludeElementsFromWebElements( | ||
List<WebElement> webElements) { | ||
List<ExcludedElement> excludeExcludedElements = new LinkedList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use ArrayList
here to have better performance. You may estimate it's size with webElements.size()
.
##### Parameters | ||
|
||
| Parameter | Value | Description | Mandatory | | ||
| --------- | ----- | ----------- | --------- | | ||
| `xpath` | xpath_to_element | Xpath to element(s) | optional (either xpath or css) | | ||
| `css` | css_selector_to_element | css selector to element(s)| optional (either xpath or css) | | ||
| `exclude-elements` | css_selector_to_element | If you provide elements in exclude-elements, they won't be checked by layout comparator, the difference won't be included for `pixelThreshold` and `percentageThreshold` and you won't see the difference on the mask. | no | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about that description:
Elements found with that selector will be ignored by layout comparator (they won't affect its results) but will be rendered on the report as captured.
6847792
to
f2dbc05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update Changelog.md
…e/exclude # Conflicts: # integration-tests/sanity-functional/src/test/java/com/cognifide/aet/sanity/functional/HomePageTilesTest.java # integration-tests/sanity-functional/src/test/resources/features/filtering.feature # integration-tests/test-suite/partials/layout.xml
Description
Merged with treshold
Added new parameter
exclude-elements
toscreen
collector.Motivation and Context
We want to compare screenshots without specified elements.
Screenshots (if appropriate):
Types of changes
Checklist:
I hereby agree to the terms of the AET Contributor License Agreement.