-
Notifications
You must be signed in to change notification settings - Fork 102
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
Sauce visual clip element #2917
Changes from 6 commits
796cbca
d660657
7035db3
c41aaf5
07d4156
c2894e7
9248bb3
9366419
da1325a
2f2fe31
00bb3e2
f8bea60
9cae1bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Alternatively, you can also pass an element directly if you've already queried one from Selenium: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,7 +321,7 @@ cy.sauceVisualCheck('Inventory Page', { | |
}); | ||
``` | ||
|
||
### Clip to an element | ||
### Clip to an Element | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
<ClippingDescription /> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ sidebar_label: Java | |
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import ClippingDescription from '../_partials/_clipping-description.md'; | ||
import ClippingElement from '../_partials/_clipping-element.md'; | ||
import FullPageLimit from '../_partials/_fullpage-limit.md'; | ||
import EnvironmentVariables from '../_partials/_environment-variables.md'; | ||
import SelectiveDiffing from '../_partials/_selective-diffing.md'; | ||
|
@@ -437,7 +438,7 @@ visual.sauceVisualCheck("Long content page", options); | |
|
||
<FullPageLimit /> | ||
|
||
### Clip to an element | ||
### Clip to an Element | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
<ClippingDescription /> | ||
|
||
|
@@ -451,6 +452,25 @@ options.setClipSelector(".your-css-selector"); | |
visual.sauceVisualCheck("Visible Sale Banner", options); | ||
``` | ||
|
||
<ClippingElement /> | ||
|
||
Example: | ||
|
||
```java | ||
import com.saucelabs.visual.CheckOptions; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.remote.RemoteWebDriver; | ||
|
||
RemoteWebDriver driver; | ||
... | ||
|
||
CheckOptions options = new CheckOptions(); | ||
WebElement element = driver.findElement(By.cssSelector(".your-css-selector")); | ||
options.setClipElement(element); | ||
visual.sauceVisualCheck("Visible Sale Banner", options); | ||
``` | ||
|
||
## Examples | ||
|
||
Two examples are available: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import Tabs from '@theme/Tabs'; | |
import TabItem from '@theme/TabItem'; | ||
import FullPageJS from '../_partials/_fullpage-js.md' | ||
import ClippingWDIO from '../_partials/_clipping-webdriver.md'; | ||
import ClippingElement from '../_partials/_clipping-element.md'; | ||
import EnvironmentVariables from '../_partials/_environment-variables.md'; | ||
import SelectiveDiffing from '../_partials/_selective-diffing.md'; | ||
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md'; | ||
|
@@ -358,10 +359,21 @@ browser | |
|
||
<FullPageJS /> | ||
|
||
### Clip to an element | ||
### Clip to an Element | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
<ClippingWDIO /> | ||
|
||
<ClippingElement /> | ||
|
||
Example: | ||
|
||
```ts | ||
await browser.sauceVisualCheck('Visible Sale Banner', { | ||
// An element that we should crop the screenshot to | ||
clipElement: browser.element('.your-css-selector') | ||
}) | ||
``` | ||
|
||
### Fail on failures | ||
|
||
By default, Sauce Visual will not fail the test if there are any failures during the comparison process. A failure will be logged in the Sauce Labs Visual dashboard, but the test will continue to run. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ sidebar_label: WebdriverIO | |
|
||
import FullPageJS from '../_partials/_fullpage-js.md'; | ||
import ClippingWDIO from '../_partials/_clipping-webdriver.md'; | ||
import ClippingElement from '../_partials/_clipping-element.md'; | ||
import EnvironmentVariables from '../_partials/_environment-variables.md'; | ||
import SelectiveDiffing from '../_partials/_selective-diffing.md'; | ||
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md'; | ||
|
@@ -268,10 +269,21 @@ browser.sauceVisualCheck('Before Login', { | |
|
||
<FullPageJS /> | ||
|
||
### Clip to an element | ||
### Clip to an Element | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
<ClippingWDIO /> | ||
|
||
<ClippingElement /> | ||
|
||
Example: | ||
|
||
```ts | ||
await browser.sauceVisualCheck('Visible Sale Banner', { | ||
// An element that we should crop the screenshot to | ||
clipElement: await $('.your-css-selector') | ||
}) | ||
``` | ||
|
||
## Example | ||
|
||
An example project is available [here](https://github.com/saucelabs/visual-examples/tree/main/wdio). |
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.
[sauce.Headings] 'Clip to an Element' should use title case capitalization.