From 44355d43becec4d0c1ecfc49bd02e4c14d547565 Mon Sep 17 00:00:00 2001 From: Roman Kuznetsov Date: Fri, 31 Oct 2025 03:24:29 +0300 Subject: [PATCH] docs: waitForStaticToLoad --- docs/_partials/specs/assert-view-options.mdx | 9 +++ docs/commands/browser/assertView.mdx | 6 ++ docs/commands/browser/waitForStaticToLoad.mdx | 64 +++++++++++++++++++ .../_partials/specs/assert-view-options.mdx | 9 +++ .../current/commands/browser/assertView.mdx | 6 ++ .../commands/browser/waitForStaticToLoad.mdx | 64 +++++++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 docs/commands/browser/waitForStaticToLoad.mdx create mode 100644 i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/waitForStaticToLoad.mdx diff --git a/docs/_partials/specs/assert-view-options.mdx b/docs/_partials/specs/assert-view-options.mdx index edae423..bcdd8fc 100644 --- a/docs/_partials/specs/assert-view-options.mdx +++ b/docs/_partials/specs/assert-view-options.mdx @@ -92,5 +92,14 @@ Default is `0`. Available starting from version `8.2.0`. + + waitForStaticToLoadTimeout + Number + + 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`. + + diff --git a/docs/commands/browser/assertView.mdx b/docs/commands/browser/assertView.mdx index daefc61..4c9d85a 100644 --- a/docs/commands/browser/assertView.mdx +++ b/docs/commands/browser/assertView.mdx @@ -12,6 +12,11 @@ Use the `assertView` command to take a screenshot for a specific test state and WebDriverIO][webdriverio-api]. + + Automatically calls the [waitForStaticToLoad][wait-for-static-to-load] command before taking a + screenshot. + + ## Usage {#usage} ```typescript @@ -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 diff --git a/docs/commands/browser/waitForStaticToLoad.mdx b/docs/commands/browser/waitForStaticToLoad.mdx new file mode 100644 index 0000000..9f4ee1b --- /dev/null +++ b/docs/commands/browser/waitForStaticToLoad.mdx @@ -0,0 +1,64 @@ +import Admonition from "@theme/Admonition"; +import Version from "../../_partials/specs/version.mdx"; + +# waitForStaticToLoad + + + +## 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`. + + + 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`. + + +## 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} + + + + + + + + + + + + + + + + + + + + + + + + +
**Name****Type****Default****Description**
timeoutNumber5000Timeout in milliseconds.
intervalNumber500Interval in milliseconds between condition checks.
+ +## Related Commands {#related} + +- [browser.assertView](../../browser/assertView) diff --git a/i18n/ru/docusaurus-plugin-content-docs/current/_partials/specs/assert-view-options.mdx b/i18n/ru/docusaurus-plugin-content-docs/current/_partials/specs/assert-view-options.mdx index 873db6b..c4884f2 100644 --- a/i18n/ru/docusaurus-plugin-content-docs/current/_partials/specs/assert-view-options.mdx +++ b/i18n/ru/docusaurus-plugin-content-docs/current/_partials/specs/assert-view-options.mdx @@ -92,5 +92,14 @@ очень маленьких диффов. По умолчанию `0`. Доступен начиная с версии `8.2.0` + + waitForStaticToLoadTimeout + Number + + Таймаут для команды `waitForStaticToLoad`, автоматически вызываемой перед снятием + скриншота. При значении `0`. ожидание выключено. По умолчанию `5000`. Доступно + начиная с версии `8.32.0`. + + diff --git a/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/assertView.mdx b/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/assertView.mdx index 45db597..d6ffffb 100644 --- a/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/assertView.mdx +++ b/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/assertView.mdx @@ -11,6 +11,11 @@ import AssertViewOptions from "../../_partials/specs/assert-view-options.mdx"; Эта команда реализована внутри Testplane, в [API WebDriverIO][webdriverio-api] её нет. + + Автоматически вызывает команду [waitForStaticToLoad][wait-for-static-to-load] перед снятием + скриншота. + + ## Использование {#usage} ```typescript @@ -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 diff --git a/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/waitForStaticToLoad.mdx b/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/waitForStaticToLoad.mdx new file mode 100644 index 0000000..da2815b --- /dev/null +++ b/i18n/ru/docusaurus-plugin-content-docs/current/commands/browser/waitForStaticToLoad.mdx @@ -0,0 +1,64 @@ +import Admonition from "@theme/Admonition"; +import Version from "../../_partials/specs/version.mdx"; + +# waitForStaticToLoad + + + +## Обзор {#overview} + +Используйте команду `waitForStaticToLoad`, чтобы дождаться загрузки статических элементов на странице, таких как шрифты, CSS-стили и картинки. + +По достижении таймаута, если страница все еще не загружена, не выбрасывает ошибку, а возвращает результат с причиной. + +Автоматически вызывается при выполнении `assertView`. + + + Если картинка загружается из-за свойства `background-image`, описанного во внешних CSS-стилях, + Testplane сможет дождаться этой картинки только если эти стили раздаются с локального сервера, + либо если у элемента присутствует атрибут `crossorigin` в значении `anonymous`. + + +## Использование {#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} + + + + + + + + + + + + + + + + + + + + + + + + +
**Имя****Тип****По умолчанию****Описание**
timeoutNumber5000Таймаут в миллисекундах.
intervalNumber500Интервал в миллисекундах между проверками условия.
+ +## Связанные команды {#related} + +- [browser.assertView](../../browser/assertView)