Skip to content

Commit d51214a

Browse files
Merge pull request #101 from gemini-testing/TESTPLANE-508.docs
docs: waitForStaticToLoad
2 parents df78971 + 44355d4 commit d51214a

File tree

6 files changed

+158
-0
lines changed

6 files changed

+158
-0
lines changed

docs/_partials/specs/assert-view-options.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,14 @@
9292
Default is `0`. Available starting from version `8.2.0`.
9393
</td>
9494
</tr>
95+
<tr>
96+
<td>waitForStaticToLoadTimeout</td>
97+
<td>Number</td>
98+
<td>
99+
Timeout for `waitForStaticToLoad` command, which is automatically called before
100+
taking screenshot. Waiting is disabled, if value is set to `0`. Default is `5000`.
101+
Available starting from version `8.32.0`.
102+
</td>
103+
</tr>
95104
</tbody>
96105
</table>

docs/commands/browser/assertView.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ Use the `assertView` command to take a screenshot for a specific test state and
1212
WebDriverIO][webdriverio-api].
1313
</Admonition>
1414

15+
<Admonition type="info">
16+
Automatically calls the [waitForStaticToLoad][wait-for-static-to-load] command before taking a
17+
screenshot.
18+
</Admonition>
19+
1520
## Usage {#usage}
1621

1722
```typescript
@@ -113,3 +118,4 @@ it("should assert view with given options", async ({ browser }) => {
113118
[webdriverio-api]: https://webdriver.io/docs/api
114119
[browsers-tolerance]: ../../../config/browsers#tolerance
115120
[browsers-antialiasing-tolerance]: ../../../config/browsers#antialiasing_tolerance
121+
[wait-for-static-to-load]: ../waitForStaticToLoad
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import Admonition from "@theme/Admonition";
2+
import Version from "../../_partials/specs/version.mdx";
3+
4+
# waitForStaticToLoad
5+
6+
<Version version="8.32.0" />
7+
8+
## Overview {#overview}
9+
10+
Use the `waitForStaticToLoad` command to wait for static elements on the page to load, such as fonts, CSS styles, and images.
11+
12+
When the timeout is reached, if the page is still not loaded, it does not throw an error but returns a result with the reason.
13+
14+
Automatically called when executing `assertView`.
15+
16+
<Admonition type="warning">
17+
If an image is loaded via the `background-image` property defined in external CSS styles,
18+
Testplane will only be able to wait for this image if these styles are served from a local
19+
server, or if the element has a `crossorigin` attribute set to `anonymous`.
20+
</Admonition>
21+
22+
## Usage {#usage}
23+
24+
```javascript
25+
const result = await browser.waitForStaticToLoad({ timeout: 5000, interval: 300 });
26+
// { ready: true }
27+
// { ready: false, reason: "Document is loading" }
28+
// { ready: false, reason: "JavaScript is running" }
29+
// { ready: false, reason: "Fonts are loading" }
30+
// { ready: false, reason: "Image from https://example.com/image.jpg is loading" }
31+
// { ready: false, reason: "Styles from https://example.com/style.css are loading" }
32+
// { ready: false, reason: "Resources are not loaded", pendingResources: ["https://example.com/image.jpg"] }
33+
```
34+
35+
## Command Parameters {#parameters}
36+
37+
<table>
38+
<thead>
39+
<tr>
40+
<td>**Name**</td>
41+
<td>**Type**</td>
42+
<td>**Default**</td>
43+
<td>**Description**</td>
44+
</tr>
45+
</thead>
46+
<tbody>
47+
<tr>
48+
<td>timeout</td>
49+
<td>Number</td>
50+
<td>5000</td>
51+
<td>Timeout in milliseconds.</td>
52+
</tr>
53+
<tr>
54+
<td>interval</td>
55+
<td>Number</td>
56+
<td>500</td>
57+
<td>Interval in milliseconds between condition checks.</td>
58+
</tr>
59+
</tbody>
60+
</table>
61+
62+
## Related Commands {#related}
63+
64+
- [browser.assertView](../../browser/assertView)

i18n/ru/docusaurus-plugin-content-docs/current/_partials/specs/assert-view-options.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,14 @@
9292
очень маленьких диффов. По умолчанию `0`. Доступен начиная с версии `8.2.0`
9393
</td>
9494
</tr>
95+
<tr>
96+
<td>waitForStaticToLoadTimeout</td>
97+
<td>Number</td>
98+
<td>
99+
Таймаут для команды `waitForStaticToLoad`, автоматически вызываемой перед снятием
100+
скриншота. При значении `0`. ожидание выключено. По умолчанию `5000`. Доступно
101+
начиная с версии `8.32.0`.
102+
</td>
103+
</tr>
95104
</tbody>
96105
</table>

i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/assertView.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import AssertViewOptions from "../../_partials/specs/assert-view-options.mdx";
1111
Эта команда реализована внутри Testplane, в [API WebDriverIO][webdriverio-api] её нет.
1212
</Admonition>
1313

14+
<Admonition type="info">
15+
Автоматически вызывает команду [waitForStaticToLoad][wait-for-static-to-load] перед снятием
16+
скриншота.
17+
</Admonition>
18+
1419
## Использование {#usage}
1520

1621
```typescript
@@ -111,3 +116,4 @@ it("should assert view with given options", async ({ browser }) => {
111116
[webdriverio-api]: https://webdriver.io/docs/api
112117
[browsers-tolerance]: ../../../config/browsers#tolerance
113118
[browsers-antialiasing-tolerance]: ../../../config/browsers#antialiasing_tolerance
119+
[wait-for-static-to-load]: ../waitForStaticToLoad
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import Admonition from "@theme/Admonition";
2+
import Version from "../../_partials/specs/version.mdx";
3+
4+
# waitForStaticToLoad
5+
6+
<Version version="8.32.0" />
7+
8+
## Обзор {#overview}
9+
10+
Используйте команду `waitForStaticToLoad`, чтобы дождаться загрузки статических элементов на странице, таких как шрифты, CSS-стили и картинки.
11+
12+
По достижении таймаута, если страница все еще не загружена, не выбрасывает ошибку, а возвращает результат с причиной.
13+
14+
Автоматически вызывается при выполнении `assertView`.
15+
16+
<Admonition type="warning">
17+
Если картинка загружается из-за свойства `background-image`, описанного во внешних CSS-стилях,
18+
Testplane сможет дождаться этой картинки только если эти стили раздаются с локального сервера,
19+
либо если у элемента присутствует атрибут `crossorigin` в значении `anonymous`.
20+
</Admonition>
21+
22+
## Использование {#usage}
23+
24+
```javascript
25+
const result = await browser.waitForStaticToLoad({ timeout: 5000, interval: 300 });
26+
// { ready: true }
27+
// { ready: false, reason: "Document is loading" }
28+
// { ready: false, reason: "JavaScript is running" }
29+
// { ready: false, reason: "Fonts are loading" }
30+
// { ready: false, reason: "Image from https://example.com/image.jpg is loading" }
31+
// { ready: false, reason: "Styles from https://example.com/style.css are loading" }
32+
// { ready: false, reason: "Resources are not loaded", pendingResources: ["https://example.com/image.jpg"] }
33+
```
34+
35+
## Параметры команды {#parameters}
36+
37+
<table>
38+
<thead>
39+
<tr>
40+
<td>**Имя**</td>
41+
<td>**Тип**</td>
42+
<td>**По&nbsp;умолчанию**</td>
43+
<td>**Описание**</td>
44+
</tr>
45+
</thead>
46+
<tbody>
47+
<tr>
48+
<td>timeout</td>
49+
<td>Number</td>
50+
<td>5000</td>
51+
<td>Таймаут в миллисекундах.</td>
52+
</tr>
53+
<tr>
54+
<td>interval</td>
55+
<td>Number</td>
56+
<td>500</td>
57+
<td>Интервал в миллисекундах между проверками условия.</td>
58+
</tr>
59+
</tbody>
60+
</table>
61+
62+
## Связанные команды {#related}
63+
64+
- [browser.assertView](../../browser/assertView)

0 commit comments

Comments
 (0)