8000 Visual step doesn't process defined exclusions in case of custom configuration by PavelSakharchuk · Pull Request #4562 · vividus-framework/vividus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Visual step doesn't process defined exclusions in case of custom configuration #4562

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.vividus.selenium.screenshot;

import java.util.Objects;
import java.util.Optional;

import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -51,10 +52,11 @@ protected WebAshotFactory(ScreenshotCropper screenshotCropper, WebJavascriptActi
@Override
public AShot create(Optional<WebScreenshotParameters> screenshotParameters)
{
return screenshotParameters.map(ashotParameters -> ashotParameters.getShootingStrategy()
.map(this::createAShot)
.orElseGet(() -> createAShot(ashotParameters)))
.orElseGet(() -> createAShot(getScreenshotShootingStrategy()));
return screenshotParameters
.map(ashotParameters -> ashotParameters.getShootingStrategy()
.map(strategy -> createAShot(strategy, ashotParameters))
.orElseGet(() -> createAShot(ashotParameters)))
.orElseGet(() -> createAShot(getScreenshotShootingStrategy(), null));
}

private AShot createAShot(WebScreenshotParameters screenshotParameters)
Expand Down Expand Up @@ -100,7 +102,7 @@ private ShootingStrategy decorateWithScrollbarHiding(ShootingStrategy strategy,
return new ScrollbarHidingDecorator(strategy, scrollableElement, scrollbarHandler);
}

private AShot createAShot(String strategyName)
private AShot createAShot(String strategyName, WebScreenshotParameters screenshotParameters)
{
ShootingStrategy baseShootingStrategy = getBaseShootingStrategy();
ShootingStrategy shootingStrategy;
Expand All @@ -122,6 +124,10 @@ private AShot createAShot(String strategyName)
String.format("Unknown shooting strategy with the name: %s", strategyName));
};
shootingStrategy = decorateWithScrollbarHiding(shootingStrategy, Optional.empty());
shootingStrategy = Objects.isNull(screenshotParameters)
? shootingStrategy
: decorateWithCropping(shootingStrategy, screenshotParameters);

return new AShot().shootingStrategy(shootingStrategy)
.coordsProvider(new ScrollBarHidingCoordsProviderDecorator(coordsProvider, scrollbarHandler));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ void shouldCreateAshotViaScreenshotShootingStrategyUsingStrategyFromConfiguratio
var aShot = factory.create(Optional.of(screenshotParameters));
validateCoordsProvider(aShot);
var baseStrategy = (ShootingStrategy) FieldUtils.readField(aShot, SHOOTING_STRATEGY, true);
assertThat(baseStrategy, instanceOf(ScrollbarHidingDecorator.class));
assertThat(FieldUtils.readField(baseStrategy, SHOOTING_STRATEGY, true),
var shootingStrategy = (ShootingStrategy) FieldUtils.readField(baseStrategy, SHOOTING_STRATEGY, true);
assertThat(baseStrategy, instanceOf(ElementCroppingDecorator.class));
assertThat(shootingStrategy, instanceOf(ScrollbarHidingDecorator.class));
assertThat(FieldUtils.readField(shootingStrategy, SHOOTING_STRATEGY, true),
instanceOf(DebuggingViewportPastingDecorator.class));
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Description: System tests for Visual plugin steps

Meta:
@epic vividus-plugin-visual

Scenario: Validation shootingStrategy visual testing on a page with scrollable element with ignores
Given I am on page with URL `${vividus-test-site-url}/visualTestIntegration.html`
When I compare_against baseline with name `visual-simple-shootingStrategy-with-ignores` using storage `filesystem` and ignoring:
|ELEMENT |
|xpath(//a[1])|
and screenshot configuration:
|shootingStrategy|
|SIMPLE |
When I compare_against baseline with name `visual-viewportPasting-shootingStrategy-with-ignores` using storage `filesystem` and ignoring:
|ELEMENT |
|xpath(//a[1])|
and screenshot configuration:
|shootingStrategy|
|VIEWPORT_PASTING|
0