-
Notifications
You must be signed in to change notification settings - Fork 2
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
docs: add info about expect timeout configuration #51
Open
sipayRT
wants to merge
1
commit into
master
Choose a base branch
from
sp.addExpectConfig
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
sidebar_class_name: hidden | ||
--- | ||
|
||
# Assertion with Expect | ||
|
||
## Overview | ||
|
||
When writing tests, it's often necessary to ensure that values meet certain criteria. With the `expect` function you have access to a variety of matchers that help verify different characteristics of the browser, element, or object mock. | ||
|
||
For example, you can check if the browser is on a specific page | ||
|
||
```typescript | ||
await browser.url("https://webdriver.io/"); | ||
// ... | ||
await expect(browser).toHaveUrl("https://webdriver.io"); | ||
``` | ||
|
||
or check if the element has an attribute with the specified value | ||
|
||
```typescript | ||
const myInput = await browser.$("input"); | ||
await expect(myInput).toHaveAttribute("class", "form-control"); | ||
``` | ||
|
||
or check if the specified request has been made for your mock | ||
|
||
```typescript | ||
const mock = browser.mock("**/api/todo*"); | ||
// ... | ||
await expect(mock).toBeRequested(); | ||
``` | ||
|
||
By default, the timeout for executing asserts is 2000ms with a check interval of 100ms. However, if necessary, these values can be redefined in the [system section][system_config] in the general config. | ||
|
||
```typescript | ||
{ | ||
// another testplane configs | ||
system: { | ||
expectOpts: { | ||
wait: 5000, | ||
interval: 200, | ||
} | ||
} | ||
} | ||
``` | ||
|
||
[system_config]: ../../../config/system#expect_opts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
i18n/ru/docusaurus-plugin-content-docs/current/commands/expect/overview.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
sidebar_class_name: hidden | ||
--- | ||
|
||
# Ассерты с помощью Expect | ||
|
||
## Обзор | ||
|
||
В ходе написания тестов нужно часто удостовериться, что значения отвечают определённым требованиям. С помощью функции expect у вас есть доступ к множеству «матчеров», которые помогают проверить различные характеристики браузера, элемента или мока объекта. | ||
|
||
Например, можно проверить находится ли браузер на заданной странице | ||
|
||
```typescript | ||
await browser.url("https://webdriver.io/"); | ||
// ... | ||
await expect(browser).toHaveUrl("https://webdriver.io"); | ||
``` | ||
|
||
или проверить есть ли у элемента атрибут с заданным значением | ||
|
||
```typescript | ||
const myInput = await browser.$("input"); | ||
await expect(myInput).toHaveAttribute("class", "form-control"); | ||
``` | ||
|
||
или проверить был ли сделан указанный запрос для вашего мока | ||
|
||
```typescript | ||
const mock = browser.mock("**/api/todo*"); | ||
// ... | ||
await expect(mock).toBeRequested(); | ||
``` | ||
|
||
По умолчанию таймаут на выполнение ассертов равен 2000мс с интервалом проверок в 100мс. Но при необходимости эти значения можно переопределить в [секции system][system_config] в общем конфиге. | ||
|
||
```typescript | ||
{ | ||
// другие настройки testplane | ||
system: { | ||
expectOpts: { | ||
wait: 5000, | ||
interval: 200, | ||
} | ||
} | ||
} | ||
``` | ||
|
||
[system_config]: ../../../config/system#expect_opts |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page is not accessible from the website (https://testplane-ci.website.yandexcloud.net/testplane-docs/website-static/12693202346-209-1/)
You need to link this mdx page