Skip to content

Commit 8814624

Browse files
kb-keremKerem BeygoAlex Plischke
authored
Sauce visual clip element (#2917)
* c# clip selector * clip element docs * clip element docs * clip element docs * capitalize title * drop clipSelector on docs * fix links * fix links * fix links * fix links --------- Co-authored-by: Kerem Beygo <[email protected]> Co-authored-by: Alex Plischke <[email protected]>
1 parent ff3d039 commit 8814624

File tree

7 files changed

+53
-26
lines changed

7 files changed

+53
-26
lines changed

docs/visual-testing/_partials/_clipping-description.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
You can clip to a specific element on the page by using the `clipSelector` option when calling Sauce visual.
1+
You can clip to a specific element on the page by using the `clipElement` option when calling Sauce Visual.
22

33
Notes:
44

docs/visual-testing/_partials/_clipping-webdriver.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/visual-testing/integrations/csharp.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ sidebar_label: C#/.Net
44

55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
7+
import ClippingDescription from '../_partials/_clipping-description.md';
78
import EnvironmentVariables from '../_partials/_environment-variables.md';
89
import FullPageLimit from '../_partials/_fullpage-limit.md';
910
import SelectiveDiffing from '../_partials/_selective-diffing.md';
@@ -441,6 +442,21 @@ await VisualClient.VisualCheck("C# full page config",
441442

442443
<FullPageLimit />
443444

445+
### Clip to an Element
446+
447+
<ClippingDescription />
448+
449+
Example:
450+
451+
```csharp
452+
var element = Driver.FindElementByCssSelector(".your-css-selector");
453+
await VisualClient.VisualCheck("Visible Sale Banner",
454+
new VisualCheckOptions()
455+
{
456+
ClipElement = element,
457+
});
458+
```
459+
444460
## Examples
445461

446462
Two examples are available:

docs/visual-testing/integrations/cypress.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ sidebar_label: Cypress
44

55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
7-
import ClippingDescription from '../_partials/_clipping-description.md';
87
import EnvironmentVariables from '../_partials/_environment-variables.md';
98
import SelectiveDiffing from '../_partials/_selective-diffing.md';
109
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
@@ -321,9 +320,9 @@ cy.sauceVisualCheck('Inventory Page', {
321320
});
322321
```
323322

324-
### Clip to an element
323+
### Clip to an Element
325324

326-
<ClippingDescription />
325+
You can clip to a specific element on the page by using the `clipSelector` option.
327326

328327
Example:
329328

docs/visual-testing/integrations/java.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,18 +437,24 @@ visual.sauceVisualCheck("Long content page", options);
437437

438438
<FullPageLimit />
439439

440-
### Clip to an element
440+
### Clip to an Element
441441

442442
<ClippingDescription />
443443

444444
Example:
445445

446446
```java
447447
import com.saucelabs.visual.CheckOptions;
448+
import org.openqa.selenium.By;
449+
import org.openqa.selenium.WebElement;
450+
import org.openqa.selenium.remote.RemoteWebDriver;
448451

449-
CheckOptions options = new CheckOptions();
450-
options.setClipSelector(".your-css-selector");
451-
visual.sauceVisualCheck("Visible Sale Banner", options);
452+
RemoteWebDriver driver;
453+
...
454+
455+
WebElement element = driver.findElement(By.cssSelector(".your-css-selector"));
456+
visual.sauceVisualCheck(
457+
"Visible Sale Banner", new CheckOptions.Builder().withClipElement(element).build());
452458
```
453459

454460
## Examples

docs/visual-testing/integrations/nightwatch.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_label: Nightwatch
55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
77
import FullPageJS from '../_partials/_fullpage-js.md'
8-
import ClippingWDIO from '../_partials/_clipping-webdriver.md';
8+
import ClippingDescription from '../_partials/_clipping-description.md';
99
import EnvironmentVariables from '../_partials/_environment-variables.md';
1010
import SelectiveDiffing from '../_partials/_selective-diffing.md';
1111
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
@@ -358,9 +358,18 @@ browser
358358
359359
<FullPageJS />
360360
361-
### Clip to an element
361+
### Clip to an Element
362362
363-
<ClippingWDIO />
363+
<ClippingDescription />
364+
365+
Example:
366+
367+
```ts
368+
await browser.sauceVisualCheck('Visible Sale Banner', {
369+
// An element that we should crop the screenshot to
370+
clipElement: browser.element('.your-css-selector')
371+
})
372+
```
364373
365374
### Fail on failures
366375

docs/visual-testing/integrations/webdriverio.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sidebar_label: WebdriverIO
33
---
44

55
import FullPageJS from '../_partials/_fullpage-js.md';
6-
import ClippingWDIO from '../_partials/_clipping-webdriver.md';
6+
import ClippingDescription from '../_partials/_clipping-description.md';
77
import EnvironmentVariables from '../_partials/_environment-variables.md';
88
import SelectiveDiffing from '../_partials/_selective-diffing.md';
99
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
@@ -268,9 +268,18 @@ browser.sauceVisualCheck('Before Login', {
268268

269269
<FullPageJS />
270270

271-
### Clip to an element
271+
### Clip to an Element
272272

273-
<ClippingWDIO />
273+
<ClippingDescription />
274+
275+
Example:
276+
277+
```ts
278+
await browser.sauceVisualCheck('Visible Sale Banner', {
279+
// An element that we should crop the screenshot to
280+
clipElement: await $('.your-css-selector')
281+
})
282+
```
274283

275284
## Example
276285

0 commit comments

Comments
 (0)