diff --git a/visual-java/src/main/java/com/saucelabs/visual/model/FullPageScreenshotConfig.java b/visual-java/src/main/java/com/saucelabs/visual/model/FullPageScreenshotConfig.java index f2137c46..2242e3b8 100644 --- a/visual-java/src/main/java/com/saucelabs/visual/model/FullPageScreenshotConfig.java +++ b/visual-java/src/main/java/com/saucelabs/visual/model/FullPageScreenshotConfig.java @@ -1,5 +1,6 @@ package com.saucelabs.visual.model; +import com.saucelabs.visual.graphql.type.ScrollOption; import com.saucelabs.visual.graphql.type.SelectorIn; import java.util.Arrays; import java.util.List; @@ -15,6 +16,7 @@ public class FullPageScreenshotConfig { private int scrollLimit; private String scrollElement; private SelectorIn nativeClipSelector; + private ScrollOption scrollOption; public FullPageScreenshotConfig( int delayAfterScrollMs, @@ -30,17 +32,38 @@ public FullPageScreenshotConfig( hideScrollBars, scrollLimit, scrollElement, + null, null); } public FullPageScreenshotConfig( + int delayAfterScrollMs, + Boolean disableCSSAnimation, + List hideAfterFirstScroll, + Boolean hideScrollBars, + int scrollLimit, + String scrollElement, + SelectorIn nativeClipSelector) { + this( + delayAfterScrollMs, + disableCSSAnimation, + hideAfterFirstScroll, + hideScrollBars, + scrollLimit, + scrollElement, + nativeClipSelector, + null); + } + + private FullPageScreenshotConfig( int delayAfterScrollMs, Boolean disableCSSAnimation, List hideAfterFirstScroll, Boolean hideScrollBars, int scrollLimit, String scrollElement, - SelectorIn nativeClipSelector) { + SelectorIn nativeClipSelector, + ScrollOption scrollOption) { this.delayAfterScrollMs = delayAfterScrollMs; this.disableCSSAnimation = disableCSSAnimation; this.hideAfterFirstScroll = hideAfterFirstScroll; @@ -48,6 +71,7 @@ public FullPageScreenshotConfig( this.scrollLimit = scrollLimit; this.scrollElement = scrollElement; this.nativeClipSelector = nativeClipSelector; + this.scrollOption = scrollOption; } public static class Builder { @@ -58,6 +82,7 @@ public static class Builder { private int scrollLimit; private String scrollElement; private SelectorIn nativeClipSelector; + private ScrollOption scrollOption; public Builder withDelayAfterScrollMs(int delayAfterScrollMs) { this.delayAfterScrollMs = delayAfterScrollMs; @@ -106,6 +131,17 @@ public Builder withNativeClipSelector(SelectorIn nativeClipSelector) { return this; } + /** + * Only effective for native app testing + * + * @param scrollOption ScrollOption to select which scroll behavior Full-Page screenshot should have. + * @return Builder instance + */ + public Builder withScrollOption(ScrollOption scrollOption) { + this.scrollOption = scrollOption; + return this; + } + public FullPageScreenshotConfig build() { return new FullPageScreenshotConfig( delayAfterScrollMs, @@ -114,7 +150,8 @@ public FullPageScreenshotConfig build() { hideScrollBars, scrollLimit, scrollElement, - nativeClipSelector); + nativeClipSelector, + scrollOption); } } @@ -183,4 +220,17 @@ public SelectorIn getNativeClipSelector() { public void setNativeClipSelector(SelectorIn nativeClipSelector) { this.nativeClipSelector = nativeClipSelector; } + + public ScrollOption getScrollOption() { + return scrollOption; + } + + /** + * Only effective for native app testing + * + * @param scrollOption ScrollOption to use + */ + public void setScrollOption(ScrollOption scrollOption) { + this.scrollOption = scrollOption; + } }