Skip to content

Commit

Permalink
Merge branch 'main' into rick/melekr/backtrace-unreal-android-update
Browse files Browse the repository at this point in the history
  • Loading branch information
rick-bt authored Dec 5, 2024
2 parents f0d3a92 + 0c5b2b8 commit b673eb8
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 40 deletions.
14 changes: 1 addition & 13 deletions docs/visual-testing/_partials/_fullpage-description.md
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
By default, only the current viewport is captured when `.sauceVisualCheck` is used. You can opt in to capturing the entire page by using the `fullPage` option. It will capture everything by scrolling and stitching multiple screenshots together.

:::note
It's recommended to use the `hideAfterFirstScroll` option for fixed or sticky position elements such as sticky headers or consent banners.
:::

Options:

- `delayAfterScrollMs`: Delay in ms after scrolling and before taking screenshots. The default value is 0. We recommend using this option for lazy loading content.
- `disableCSSAnimation`: Disable CSS animations and the input caret in the app. The default value is true.
- `hideAfterFirstScroll`: One or more CSS selectors that we should remove from the page after the first scroll. Useful for hiding fixed elements such as headers, cookie banners, etc.
- `hideScrollBars`: Hide all scrollbars in the app. The default value is true.
- `scrollLimit`: Limit the number of screenshots taken for scrolling and stitching. The default value is 10. The value needs to be between 1 and 10.
Full Page Screenshots capture the entire webpage, including content beyond the visible viewport, to ensure comprehensive visual testing. This feature helps teams identify layout or rendering issues across the full page and ensures consistency across devices and browsers.
145 changes: 140 additions & 5 deletions docs/visual-testing/_partials/_fullpage-js.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
import FullPageDescription from './_fullpage-description.md';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import FullPageLimit from './_fullpage-limit.md';
import FullPageLimitation from './_fullpage-limitation.md';
import FullPageDescription from './_fullpage-description.md';

<FullPageDescription/>
By default, only the viewport is captured when `.sauceVisualCheck` is used. You can opt in to capturing the entire page by using the `fullPage` option. It will capture everything by scrolling and stitching multiple screenshots together.

<FullPageLimit />

#### Web

Options:

<FullPageDescription />
- `delayAfterScrollMs`: Delay in ms after scrolling and before taking screenshots. The default value is 0. We recommend using this option for lazy loading content.
- `disableCSSAnimation`: Disable CSS animations and the input caret in the app. The default value is true.
- `hideAfterFirstScroll`: One or more CSS selectors that we should remove from the page after the first scroll. Useful for hiding fixed elements such as headers, cookie banners, etc.
- `hideScrollBars`: Hide all scrollbars in the app. The default value is true.
- `scrollLimit`: Limit the number of screenshots taken for scrolling and stitching. The default value is 10. The value needs to be between 1 and 10.

:::note
It's recommended to use the `hideAfterFirstScroll` option for fixed or sticky position elements such as sticky headers or consent banners.
:::

Example:

```ts
await browser.sauceVisualCheck('Long content page', {
// Enable full page screenshots using the default options
// Enable full page screenshot using the default options
fullPage: true,
});

await browser.sauceVisualCheck('Long content page', {
// Enable full page screenshots and customize the behavior
// Enable full page screenshot and customize the behavior
fullPage: {
delayAfterScrollMs: 500,
disableCSSAnimation: false,
Expand All @@ -23,4 +44,118 @@ await browser.sauceVisualCheck('Long content page', {
});
```

<FullPageLimit />
#### Mobile Native (beta)

Options:

- `delayAfterScrollMs`: Delay in ms after scrolling and before taking screenshots. The default value is 0. We recommend using this option for lazy loading content.
- `nativeClipSelector`: Selector used to identify the first element to which clipping will be applied.
- `scrollElement`: Scrollable element used for scrolling. The default is root element.
- `scrollLimit`: Limit the number of screenshots taken for scrolling and stitching. The default value is 10. The value needs to be between 1 and 10.

:::note
It is recommended to set `scrollElement` to the appropriate scrollable container.
:::

<Tabs>
<TabItem value="ios" label="iOS">
```ts
await browser.sauceVisualCheck('Long content page', {
// Enable full page screenshot and customize the behavior
fullPage: {
scrollElement: $('//XCUIElementTypeCollectionView'),
scrollLimit: 5
},
});
```
</TabItem>
<TabItem value="android" label="Android">
```ts
await browser.sauceVisualCheck('Long content page', {
// Enable full page screenshot and customize the behavior
fullPage: {
scrollElement: $('//androidx.recyclerview.widget.RecyclerView'),
scrollLimit: 5
},
});
```
</TabItem>
</Tabs>

Use only XPath selectors for ignore regions and clipping to an element.

:::note
On iOS, selectors must be contained within the `scrollElement`.
:::

<Tabs>
<TabItem value="ios" label="iOS">
```ts
await browser.sauceVisualCheck('Ignore regions - Long content page', {
// Enable full page screenshot and ignore elements
ignore: [
{
selector: {
value: '//XCUIElementTypeStaticText[@name="Product Price"]',
type: 'XPATH'
}
}
],
fullPage: {
scrollElement: $('//XCUIElementTypeCollectionView'),
},
});
```
</TabItem>
<TabItem value="android" label="Android">
```ts
await browser.sauceVisualCheck('Ignore regions - Long content page', {
// Enable full page screenshot and ignore elements
ignore: [
{
selector: {
value: '//android.widget.TextView[@content-desc="Product Price"]',
type: 'XPATH'
}
}
],
fullPage: {
scrollElement: $('//androidx.recyclerview.widget.RecyclerView'),
},
});
```
</TabItem>
</Tabs>

<Tabs>
<TabItem value="ios" label="iOS">
```ts
await browser.sauceVisualCheck('Clip - Long content page', {
// Enable full page screenshot and clip to an element
fullPage: {
scrollElement: $('//XCUIElementTypeCollectionView'),
nativeClipSelector: {
value: '//XCUIElementTypeCollectionView/XCUIElementTypeOther',
type: 'XPATH'
}
},
});
```
</TabItem>
<TabItem value="android" label="Android">
```ts
await browser.sauceVisualCheck('Clip - Long content page', {
// Enable full page screenshot and clip to an element
fullPage: {
scrollElement: $('//androidx.recyclerview.widget.RecyclerView'),
nativeClipSelector: {
value: '//androidx.recyclerview.widget.RecyclerView[@content-desc="Displays all products of catalog"]',
type: 'XPATH'
}
},
});
```
</TabItem>
</Tabs>

<FullPageLimitation/>
4 changes: 3 additions & 1 deletion docs/visual-testing/_partials/_fullpage-limit.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:::note
The maximum number of scrolls and stitches in a full page screenshot is 10.

:::note
Use full page screenshots only when necessary, as they slow down test execution.
:::
3 changes: 3 additions & 0 deletions docs/visual-testing/_partials/_fullpage-limitation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:::note
Full page screenshot for mobile native testing is in beta. Read more about [mobile native limitation](/visual-testing/mobile-native-testing/)
:::
2 changes: 1 addition & 1 deletion docs/visual-testing/integrations/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ VisualClient.CaptureDom = true;

### Full page screenshots

By default, only the current viewport is captured when `.VisualCheck` is used. You can opt in to capturing the entire page by using the `FullPage` option. It will capture everything by scrolling and stitching multiple screenshots together.
By default, only the viewport is captured when `.VisualCheck` is used. You can opt in to capturing the entire page by using the `FullPage` option. It will capture everything by scrolling and stitching multiple screenshots together.
Additionally, you have the option to configure full page settings using the `FullPageConfig` option.

:::note
Expand Down
Loading

0 comments on commit b673eb8

Please sign in to comment.