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

INT-26 frames #3089

Merged
merged 4 commits into from
Feb 20, 2025
Merged
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
8 changes: 8 additions & 0 deletions docs/visual-testing/_partials/_frames.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
You can capture screenshots of `<frame>` and `<iframe>` elements as well. To do this, switch to the desired frame before taking the screenshot.

The screenshot will include only the content in the selected frame.
Any captured DOM elements, ignored regions or clip elements must be specified in the current frame.

:::note
Frames support is available only for full page screenshots on desktop.
:::
16 changes: 16 additions & 0 deletions docs/visual-testing/integrations/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import FullPageLimit from '../_partials/_fullpage-limit.md';
import SelectiveDiffing from '../_partials/_selective-diffing.md';
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import Frames from '../_partials/_frames.md';

# C#/.Net WebDriver Integration

Expand Down Expand Up @@ -456,6 +457,21 @@ await VisualClient.VisualCheck("Visible Sale Banner",
});
```

### Frames

<Frames/>

Example:

```csharp
Driver.SwitchTo().Frame(0);
await VisualClient.VisualCheck("Frame capture",
new VisualCheckOptions()
{
FullPage = true,
});
```

## Examples

Two examples are available:
Expand Down
17 changes: 17 additions & 0 deletions docs/visual-testing/integrations/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import FullPageLimitation from '../_partials/_fullpage-limitation.md';
import FullPageDescription from '../_partials/_fullpage-description.md';
import Frames from '../_partials/_frames.md';

# Java WebDriver Integration

Expand Down Expand Up @@ -625,6 +626,22 @@ visual.sauceVisualCheck(
"Visible Sale Banner", new CheckOptions.Builder().withClipElement(element).build());
```

### Frames

<Frames/>

Example:

```java
import com.saucelabs.visual.CheckOptions;
RemoteWebDriver driver;

driver.switchTo().frame(0);
CheckOptions options = new CheckOptions();
options.enableFullPageScreenshots();
visual.sauceVisualCheck("Frame capture", options);
```

## Examples

Two examples are available:
Expand Down
15 changes: 15 additions & 0 deletions docs/visual-testing/integrations/nightwatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import EnvironmentVariables from '../_partials/_environment-variables.md';
import SelectiveDiffing from '../_partials/_selective-diffing.md';
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import Frames from '../_partials/_frames.md';

# Nightwatch Integration

Expand Down Expand Up @@ -366,6 +367,20 @@ await browser.sauceVisualCheck('Visible Sale Banner', {
})
```

### Frames

<Frames/>

Example:

```ts
browser
.frame(0)
.sauceVisualCheck('Frame capture', {
fullPage: true
})
```

### 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.
Expand Down
13 changes: 13 additions & 0 deletions docs/visual-testing/integrations/python-robot-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FullPageLimit from '../_partials/_fullpage-limit.md';
import SelectiveDiffing from '../_partials/_selective-diffing.md';
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import Frames from '../_partials/_frames.md';

# Python (Robot Framework) Integration

Expand Down Expand Up @@ -169,6 +170,18 @@ Example:

```

### Frames

<Frames/>

Example:

```robot
Test Name
Select Frame index=0
Visual Snapshot My Snapshot Name full_page_config=True
```

## Environment variables

Below are the environment variables available in the Sauce Visual Python plugin. Keep in mind that the variables defined or overridden in Robot have precedence over these.
Expand Down
22 changes: 22 additions & 0 deletions docs/visual-testing/integrations/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PythonIntro from '../_partials/_python-shared-intro.md';
import SelectiveDiffing from '../_partials/_selective-diffing.md';
import FullPageLimit from '../_partials/_fullpage-limit.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import Frames from '../_partials/_frames.md';

# Python Integration

Expand Down Expand Up @@ -228,6 +229,27 @@ Example:
)
```

### Frames

<Frames/>

Example:

```python
frame_element = driver.find_element(By.TAG_NAME, "iframe")
driver.switch_to.frame(frame_element)

visual_client.create_snapshot_from_webdriver(
"Frame capture",
driver=driver,
full_page_config=FullPageConfig(
scrollLimit=10,
),
)
```



## Environment variables

Below are the environment variables available in the Sauce Visual Python plugin. Keep in mind that the variables defined in code / configuration have precedence over these.
Expand Down
14 changes: 14 additions & 0 deletions docs/visual-testing/integrations/webdriverio.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import EnvironmentVariables from '../_partials/_environment-variables.md';
import SelectiveDiffing from '../_partials/_selective-diffing.md';
import SelectiveDiffingGlobal from '../_partials/_selective-diffing-global.md';
import SelectiveDiffingRegion from '../_partials/_selective-diffing-region.md';
import Frames from '../_partials/_frames.md';

# WebdriverIO Integration

Expand Down Expand Up @@ -281,6 +282,19 @@ await browser.sauceVisualCheck('Visible Sale Banner', {
})
```

### Frames

<Frames/>

Example:

```ts
await browser.switchToFrame(0);
await browser.sauceVisualCheck('Frame capture', {
fullPage: true,
});
```

### Using Baseline Overrides

<BaselineOverridesWDIO />
Expand Down