Skip to content
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

Merged
merged 52 commits into from
Aug 22, 2018
Merged

Feature/exclude #303

merged 52 commits into from
Aug 22, 2018

Conversation

PiteroS678
Copy link
Contributor

@PiteroS678 PiteroS678 commented Aug 3, 2018

Description

Merged with treshold
Added new parameter exclude-elements to screen collector.

Motivation and Context

We want to compare screenshots without specified elements.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

I hereby agree to the terms of the AET Contributor License Agreement.

@malaskowski malaskowski changed the base branch from master to newfeature/layout_comparator_with_treshold August 3, 2018 13:18
@@ -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");
Copy link
Contributor

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.

Copy link
Contributor

@malaskowski malaskowski left a 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) {
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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 {
Copy link
Contributor

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

@malaskowski
Copy link
Contributor

After merging #293 please change the target branch to master.

@@ -55,14 +59,27 @@

private Double percentageThreshold;

private boolean excludeFunctionIsOn = false;
Copy link
Contributor

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<>();
Copy link
Contributor

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 |
Copy link
Contributor

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.

@plutasnyy plutasnyy force-pushed the newfeature/layout_comparator_with_treshold branch 4 times, most recently from 6847792 to f2dbc05 Compare August 10, 2018 07:15
@plutasnyy plutasnyy changed the base branch from newfeature/layout_comparator_with_treshold to master August 14, 2018 07:17
Copy link
Contributor

@tkaik tkaik left a 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

tkaik and others added 2 commits August 21, 2018 17:11
…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
@tkaik tkaik merged commit 29d8ec3 into master Aug 22, 2018
@tkaik tkaik deleted the feature/exclude branch August 22, 2018 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants