Skip to content
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
9 changes: 9 additions & 0 deletions docs/_partials/specs/assert-view-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,14 @@
Default is `0`. Available starting from version `8.2.0`.
</td>
</tr>
<tr>
<td>waitForStaticToLoadTimeout</td>
<td>Number</td>
<td>
Timeout for `waitForStaticToLoad` command, which is automatically called before
taking screenshot. Waiting is disabled, if value is set to `0`. Default is `5000`.
Available starting from version `8.32.0`.
</td>
</tr>
</tbody>
</table>
6 changes: 6 additions & 0 deletions docs/commands/browser/assertView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Use the `assertView` command to take a screenshot for a specific test state and
WebDriverIO][webdriverio-api].
</Admonition>

<Admonition type="info">
Automatically calls the [waitForStaticToLoad][wait-for-static-to-load] command before taking a
screenshot.
</Admonition>

## Usage {#usage}

```typescript
Expand Down Expand Up @@ -113,3 +118,4 @@ it("should assert view with given options", async ({ browser }) => {
[webdriverio-api]: https://webdriver.io/docs/api
[browsers-tolerance]: ../../../config/browsers#tolerance
[browsers-antialiasing-tolerance]: ../../../config/browsers#antialiasing_tolerance
[wait-for-static-to-load]: ../waitForStaticToLoad
64 changes: 64 additions & 0 deletions docs/commands/browser/waitForStaticToLoad.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Admonition from "@theme/Admonition";
import Version from "../../_partials/specs/version.mdx";

# waitForStaticToLoad

<Version version="8.32.0" />

## Overview {#overview}

Use the `waitForStaticToLoad` command to wait for static elements on the page to load, such as fonts, CSS styles, and images.

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.

Automatically called when executing `assertView`.

<Admonition type="warning">
If an image is loaded via the `background-image` property defined in external CSS styles,
Testplane will only be able to wait for this image if these styles are served from a local
server, or if the element has a `crossorigin` attribute set to `anonymous`.
</Admonition>

## Usage {#usage}

```javascript
const result = await browser.waitForStaticToLoad({ timeout: 5000, interval: 300 });
// { ready: true }
// { ready: false, reason: "Document is loading" }
// { ready: false, reason: "JavaScript is running" }
// { ready: false, reason: "Fonts are loading" }
// { ready: false, reason: "Image from https://example.com/image.jpg is loading" }
// { ready: false, reason: "Styles from https://example.com/style.css are loading" }
// { ready: false, reason: "Resources are not loaded", pendingResources: ["https://example.com/image.jpg"] }
```

## Command Parameters {#parameters}

<table>
<thead>
<tr>
<td>**Name**</td>
<td>**Type**</td>
<td>**Default**</td>
<td>**Description**</td>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number</td>
<td>5000</td>
<td>Timeout in milliseconds.</td>
</tr>
<tr>
<td>interval</td>
<td>Number</td>
<td>500</td>
<td>Interval in milliseconds between condition checks.</td>
</tr>
</tbody>
</table>

## Related Commands {#related}

- [browser.assertView](../../browser/assertView)
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,14 @@
очень маленьких диффов. По умолчанию `0`. Доступен начиная с версии `8.2.0`
</td>
</tr>
<tr>
<td>waitForStaticToLoadTimeout</td>
<td>Number</td>
<td>
Таймаут для команды `waitForStaticToLoad`, автоматически вызываемой перед снятием
скриншота. При значении `0`. ожидание выключено. По умолчанию `5000`. Доступно
начиная с версии `8.32.0`.
</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import AssertViewOptions from "../../_partials/specs/assert-view-options.mdx";
Эта команда реализована внутри Testplane, в [API WebDriverIO][webdriverio-api] её нет.
</Admonition>

<Admonition type="info">
Автоматически вызывает команду [waitForStaticToLoad][wait-for-static-to-load] перед снятием
скриншота.
</Admonition>

## Использование {#usage}

```typescript
Expand Down Expand Up @@ -111,3 +116,4 @@ it("should assert view with given options", async ({ browser }) => {
[webdriverio-api]: https://webdriver.io/docs/api
[browsers-tolerance]: ../../../config/browsers#tolerance
[browsers-antialiasing-tolerance]: ../../../config/browsers#antialiasing_tolerance
[wait-for-static-to-load]: ../waitForStaticToLoad
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Admonition from "@theme/Admonition";
import Version from "../../_partials/specs/version.mdx";

# waitForStaticToLoad

<Version version="8.32.0" />

## Обзор {#overview}

Используйте команду `waitForStaticToLoad`, чтобы дождаться загрузки статических элементов на странице, таких как шрифты, CSS-стили и картинки.

По достижении таймаута, если страница все еще не загружена, не выбрасывает ошибку, а возвращает результат с причиной.

Автоматически вызывается при выполнении `assertView`.

<Admonition type="warning">
Если картинка загружается из-за свойства `background-image`, описанного во внешних CSS-стилях,
Testplane сможет дождаться этой картинки только если эти стили раздаются с локального сервера,
либо если у элемента присутствует атрибут `crossorigin` в значении `anonymous`.
</Admonition>

## Использование {#usage}

```javascript
const result = await browser.waitForStaticToLoad({ timeout: 5000, interval: 300 });
// { ready: true }
// { ready: false, reason: "Document is loading" }
// { ready: false, reason: "JavaScript is running" }
// { ready: false, reason: "Fonts are loading" }
// { ready: false, reason: "Image from https://example.com/image.jpg is loading" }
// { ready: false, reason: "Styles from https://example.com/style.css are loading" }
// { ready: false, reason: "Resources are not loaded", pendingResources: ["https://example.com/image.jpg"] }
```

## Параметры команды {#parameters}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а почему у тебя здесь таблица html-разметкой, а на англ. версии - md?
Таблицы в новых доках мы договорились сразу оформлять "красиво" (с отступами):

<table>
    <thead>
    <tr>
        <td>**Имя**</td>
        <td>**Тип**</td><td>**По&nbsp;умолчанию**</td><td>**Описание**</td>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>timeout</td>
        <td>Number</td>
        <td>5000</td>
        <td>Таймаут в миллисекундах.</td>
    </tr>
    <tr>
        <td>interval</td>
        <td>Number</td>
        <td>500</td>
        <td>Интервал в миллисекундах между проверками условия.</td>
    </tr>
    </tbody>
</table>


<table>
<thead>
<tr>
<td>**Имя**</td>
<td>**Тип**</td>
<td>**По&nbsp;умолчанию**</td>
<td>**Описание**</td>
</tr>
</thead>
<tbody>
<tr>
<td>timeout</td>
<td>Number</td>
<td>5000</td>
<td>Таймаут в миллисекундах.</td>
</tr>
<tr>
<td>interval</td>
<td>Number</td>
<td>500</td>
<td>Интервал в миллисекундах между проверками условия.</td>
</tr>
</tbody>
</table>

## Связанные команды {#related}

- [browser.assertView](../../browser/assertView)