Skip to content

Commit 09e5757

Browse files
author
rocketraccoon
committed
docs: tags docs
1 parent 09e3e31 commit 09e5757

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

docs/command-line/index.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Main command to run tests.
2121
-s, --set <set> run tests only in the specified set
2222
-r, --require <module> require module
2323
--grep <grep> run only tests matching the pattern
24+
--tag <tag> run only tests matching the pattern
2425
--reporter <name> test reporters
2526
--update-refs update screenshot references or gather them if they do not exist ("assertView" command)
2627
--inspect [inspect] nodejs inspector on [=[host:]port]
@@ -136,6 +137,48 @@ testplane --grep "with nested path"
136137
testplane --grep "test with nested path"
137138
```
138139
140+
#### Tag {#testplane-tag}
141+
142+
Run only tests, which matches the tag pattern.
143+
144+
##### Example {#testplane-tag-example}
145+
146+
You can assign tags to a test using the `{tag: string | string[]}` parameter.
147+
You can also add tags dynamically during test execution with the [addTag][add-tag] command,
148+
but tests tagged this way cannot be filtered at launch.
149+
150+
```ts
151+
describe("test", {tag: "all"}, () => {
152+
describe("with", {tag: "desktop"}, () => {
153+
describe("nested path", {tag: "smoke"}, () => {
154+
await browser.addTag("some");
155+
...
156+
});
157+
describe("other path", {tag: "slow"}, () => {
158+
...
159+
})
160+
});
161+
describe("with", {tag: "mobile"}, () => {
162+
describe("nested path", {tag: "smoke"}, () => {
163+
...
164+
});
165+
describe("other path", {tag: "slow"}, () => {
166+
...
167+
})
168+
});
169+
});
170+
```
171+
172+
You can use tags to run tests and combine them with logical operators & (and), | (or), and ! (not).
173+
174+
```bash
175+
testplane --tag "desktop"
176+
testplane --tag "mobile"
177+
testplane --tag "mobile&smoke"
178+
testplane --tag "desktop|slow"
179+
testplane --tag "!slow"
180+
```
181+
139182
#### Update refs {#testplane-update-refs}
140183
141184
Run tests, updating all screenshot references, created by [assertView][assert-view] command.
@@ -700,5 +743,6 @@ TESTPLANE_SETS=desktop,touch testplane
700743
701744
[html-reporter]: ../html-reporter/html-reporter-setup
702745
[assert-view]: ../commands/browser/assertView
746+
[add-tag]: ../commands/browser/addTag
703747
[switch-to-repl]: ../commands/browser/switchToRepl
704748
[webdriver-vs-cdp]: ../reference/webdriver-vs-cdp

docs/commands/browser/addTag.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Version from "../../_partials/specs/version.mdx";
2+
3+
# addTag
4+
5+
<Version version="8.37.0" />
6+
7+
## Overview {#overview}
8+
9+
Use the `addTag` command to add a tag (or multiple tags) to a test during execution.
10+
11+
## Usage {#usage}
12+
13+
```typescript
14+
await browser.addTag("one");
15+
await browser.addTag(["first", "second"]);
16+
```
17+
18+
## Command Parameters {#parameters}
19+
20+
<table>
21+
<thead>
22+
<tr>
23+
<td>**Name**</td>
24+
<td>**Type**</td>
25+
<td>**Description**</td>
26+
</tr>
27+
</thead>
28+
<tbody>
29+
<tr>
30+
<td>tag</td>
31+
<td>`string | string[]`</td>
32+
<td>Required parameter. A single tag string or an array of tag strings to add.</td>
33+
</tr>
34+
</tbody>
35+
</table>

i18n/ru/docusaurus-plugin-content-docs/current/command-line/index.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Admonition from "@theme/Admonition";
2121
-s, --set <set> run tests only in the specified set
2222
-r, --require <module> require module
2323
--grep <grep> run only tests matching the pattern
24+
--tag <tag> run only tests matching the pattern
2425
--reporter <name> test reporters
2526
--update-refs update screenshot references or gather them if they do not exist ("assertView" command)
2627
--inspect [inspect] nodejs inspector on [=[host:]port]
@@ -136,6 +137,48 @@ testplane --grep "with nested path"
136137
testplane --grep "test with nested path"
137138
```
138139
140+
#### Tag {#testplane-tag}
141+
142+
Запуск только тестов соответствующих паттерну:
143+
144+
##### Example {#testplane-tag-example}
145+
146+
Вы можете назначить теги тесту с помощью параметра `{tag: string | string[]}`.
147+
Также вы можете добавлять теги динамически во время выполнения теста с помощью команды [assertTag][add-tag],
148+
однако тесты, помеченные таким образом, нельзя отфильтровать при запуске.
149+
150+
```ts
151+
describe("test", {tag: "all"}, () => {
152+
describe("with", {tag: "desktop"}, () => {
153+
describe("nested path", {tag: "smoke"}, () => {
154+
await browser.addTag("some");
155+
...
156+
});
157+
describe("other path", {tag: "slow"}, () => {
158+
...
159+
})
160+
});
161+
describe("with", {tag: "mobile"}, () => {
162+
describe("nested path", {tag: "smoke"}, () => {
163+
...
164+
});
165+
describe("other path", {tag: "slow"}, () => {
166+
...
167+
})
168+
});
169+
});
170+
```
171+
172+
Вы можете использовать теги для запуска тестов, комбинируя их с логическими операторами & (и), | (или) и ! (не).
173+
174+
```bash
175+
testplane --tag "desktop"
176+
testplane --tag "mobile"
177+
testplane --tag "mobile&smoke"
178+
testplane --tag "desktop|slow"
179+
testplane --tag "!slow"
180+
```
181+
139182
#### Update-refs {#testplane-update-refs}
140183
141184
Запуск тестов с обновлением всех ссылок на скриншоты, созданных командой [assertView][assert-view].
@@ -701,5 +744,6 @@ TESTPLANE_SETS=desktop,touch testplane
701744
702745
[html-reporter]: ../html-reporter/html-reporter-setup
703746
[assert-view]: ../commands/browser/assertView
747+
[add-tag]: ../commands/browser/addTag
704748
[switch-to-repl]: ../commands/browser/switchToRepl
705749
[webdriver-vs-cdp]: ../reference/webdriver-vs-cdp
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import Version from "../../_partials/specs/version.mdx";
2+
3+
# addTag
4+
5+
<Version version="8.37.0" />
6+
7+
## Обзор {#overview}
8+
9+
Используйте команду `addTag`, чтобы добавить один или несколько тегов к тесту во время его выполнения.
10+
11+
## Использование {#usage}
12+
13+
```typescript
14+
await browser.addTag("one");
15+
await browser.addTag(["first", "second"]);
16+
```
17+
18+
## Параметры команды {#parameters}
19+
20+
<table>
21+
<thead>
22+
<tr>
23+
<td>**Имя**</td>
24+
<td>**Тип**</td>
25+
<td>**Описание**</td>
26+
</tr>
27+
</thead>
28+
<tbody>
29+
<tr>
30+
<td>tag</td>
31+
<td>`string | string[]`</td>
32+
<td>Обязательный параметр. Одна строка или массив строк.</td>
33+
</tr>
34+
</tbody>
35+
</table>

0 commit comments

Comments
 (0)