Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/commands/browser/restoreState.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Admonition from "@theme/Admonition";
import Version from "../../_partials/specs/version-en.mdx";
import Version from "../../_partials/specs/version.mdx";

# restoreState

Expand Down
2 changes: 1 addition & 1 deletion docs/commands/browser/saveState.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Version from "../../_partials/specs/version-en.mdx";
import Version from "../../_partials/specs/version.mdx";

# saveState

Expand Down
4 changes: 2 additions & 2 deletions docs/config/after-all.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Version from "../_partials/specs/version-en.mdx";
import Version from "../_partials/specs/version.mdx";

# afterAll

<Version version="8.33.0" />
<Version version="8.31.7" />

## Overview {#overview}

Expand Down
4 changes: 2 additions & 2 deletions docs/config/before-all.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Version from "../_partials/specs/version-en.mdx";
import Version from "../_partials/specs/version.mdx";

# beforeAll

<Version version="8.33.0" />
<Version version="8.31.7" />

## Overview {#overview}

Expand Down
81 changes: 79 additions & 2 deletions docs/html-reporter/html-reporter-setup.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Version from "../_partials/specs/version.mdx";

---
sidebar_position: 2
---

## sidebar_position: 2

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
Expand Down Expand Up @@ -35,6 +37,7 @@ import ConfigExamples from "/docs/_partials/html-reporter-config-examples.mdx";
<tr><td>[plugins](#plugins)</td><td>`Plugin[]`</td><td>`[]`</td><td>A list of plugins with their settings.</td></tr>
<tr><td>[customScripts](#customscripts)</td><td>`AnyFunction[]`</td><td>`[]`</td><td>A list of functions that implement custom scripts. For example, Yandex.Metrika scripts or a Bug.</td></tr>
<tr><td>[yandexMetrika](#yandexmetrika)</td><td>`YandexMetrika`</td><td>*see below*</td><td>[Yandex.Metrika][yandex-metrika].</td></tr>
<tr><td>[generateBadge](#badgeformatter)</td><td>`BadgeFormatter`</td><td>`null`</td><td>A callback that is called after every test run. It receives the test result and returns a list of badges.</td></tr>
Copy link
Member

Choose a reason for hiding this comment

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

Callback is called "generateBadge", but anchor is still "#badgeformatter"


</tbody>
</table>
Expand Down Expand Up @@ -288,6 +291,79 @@ If you don't want to share analytics with us, you can disable it in any of the f
- Using environment variables: `html_reporter_yandex_metrika_enabled=false` or simply `NO_ANALYTICS=true`
- Using CLI arguments: `--html-reporter-yandex_metrika_enabled=false`

### generateBadge

<Version version="11.4.0" />

A callback that is called after every test run. It receives the test result and returns a list of badges.

Usage example: here we set the ticket name and URL, the branch name.
Copy link
Member

Choose a reason for hiding this comment

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

lets not use the word "ticket"
In your title and url you use "issue", which is better. Lets use "issue" here instead of "ticket" for consistency


```typescript title="testplane.config.ts"
{
// other Testplane config...
plugins: {
"html-reporter/testplane": {
//...
generateBadge: (test) => [
{
title: test.meta.issueTitle,
icon: 'LogoYandexTracker',
url: test.meta.issueUrl,
},
{
title: test.meta.branch,
icon: 'BranchesRight',
},
]
}
}
}
```

An example of a test where you can set metadata.

```typescript title="testplane.config.ts"
describe("badges", () => {
it("badge example", async ({ browser }) => {
await browser.setMeta("issueTitle", "ticket-1234");
await browser.setMeta("issueUrl", "https://example.com");
await browser.setMeta("branch", "master");

await browser.pause(3000);
});
});
```

#### Badge params

<table>
<thead>
<tr>
<td>**Name**</td>
<td>**Type**</td>
<td>**Description**</td>
</tr>
</thead>
<tbody>
<tr>
<td>`title`</td>
<td>`string`</td>
<td>Required parameter. Displayed badge title.</td>
</tr>
<tr>
<td>`icon`</td>
<td>`string`</td>
<td>Optional parameter. Name of icon from [GravityUI][gravity-ui-icons].</td>
</tr>
<tr>
<td>`url`</td>
<td>`string`</td>
<td>Optional parameter. Url of badge.</td>
</tr>
</tbody>
</table>

### Passing parameters via the CLI {#setup_by_cli}

All plugin parameters that can be defined in the config can also be passed as command line options or through environment variables during Testplane startup. Use the prefix `--html-reporter-` for command line options and `html_reporter_` for environment variables.
Expand Down Expand Up @@ -328,3 +404,4 @@ Files that are created during the execution of tests:
[how-to-create-counter]: https://yandex.ru/support/metrica/general/creating-counter.html
[merge-reports]: ../html-reporter-commands#merge-reports
[http-server]: https://github.com/http-party/http-server#http-server-a-simple-static-http-server
[gravity-ui-icons]: https://gravity-ui.com/ru/icons
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Admonition from "@theme/Admonition";
import Version from "../../../../../../docs/_partials/specs/version-ru.mdx";
import Version from "../../_partials/specs/version.mdx";

# restoreState

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Version from "../../../../../../docs/_partials/specs/version-ru.mdx";
import Version from "../../_partials/specs/version.mdx";

# saveState

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Version from "../../../../../docs/_partials/specs/version-ru.mdx";
import Version from "../_partials/specs/version.mdx";

# afterAll

<Version version="8.33.0" />
<Version version="8.31.7" />

## Обзор {#overview}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Version from "../../../../../docs/_partials/specs/version-ru.mdx";
import Version from "../_partials/specs/version.mdx";

# beforeAll

<Version version="8.33.0" />
<Version version="8.31.7" />

## Обзор {#overview}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Version from "../_partials/specs/version.mdx";

---
sidebar_position: 2
---

## sidebar_position: 2

import Admonition from "@theme/Admonition";
import ConfigExamples from "../_partials/html-reporter-config-examples.mdx";
Expand Down Expand Up @@ -33,6 +35,7 @@ import ConfigExamples from "../_partials/html-reporter-config-examples.mdx";
<tr><td>[plugins](#plugins)</td><td>`Plugin[]`</td><td>`[]`</td><td>Список плагинов с их настройками.</td></tr>
<tr><td>[customScripts](#customscripts)</td><td>`AnyFunction[]`</td><td>`[]`</td><td>Список функций, реализующих кастомные скрипты. Например, скрипты Яндекс.Метрики или Жучка.</td></tr>
<tr><td>[yandexMetrika](#yandexmetrika)</td><td>`YandexMetrika`</td><td>*см. ниже*</td><td>[Яндекс.Метрика][yandex-metrika].</td></tr>
<tr><td>[generateBadge](#badgeformatter)</td><td>`BadgeFormatter`</td><td>`null`</td><td>Колбэк, который вызывается после каждого запуска теста. Он получает результат теста и возвращает список бейджей.</td></tr>
Copy link
Member

Choose a reason for hiding this comment

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

В русской документации не принято использовать слово "колбэк". Лучше "функция"


</tbody>
</table>
Expand Down Expand Up @@ -286,6 +289,79 @@ customScripts: [
- С помощью переменных окружения: `html_reporter_yandex_metrika_enabled=false` или просто `NO_ANALYTICS=true`
- С помощью аргументов CLI: `--html-reporter-yandex_metrika_enabled=false`

### generateBadge

<Version version="11.4.0" />

Колбэк, который вызывается после каждого запуска теста. Он получает результат теста и возвращает список бейджей.
Copy link
Member

Choose a reason for hiding this comment

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

функция


Пример использования: здесь мы задаём название тикета и URL, название ветки.
Copy link
Member

Choose a reason for hiding this comment

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

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

Давай лучше "ключ задачи"


```typescript title="testplane.config.ts"
{
// other Testplane config...
plugins: {
"html-reporter/testplane": {
//...
generateBadge: (test) => [
{
title: test.meta.issueTitle,
icon: 'LogoYandexTracker',
url: test.meta.issueUrl,
},
{
title: test.meta.branch,
icon: 'BranchesRight',
},
]
}
}
}
```

Пример как можно установить метаданные в тесте.
Copy link
Member

Choose a reason for hiding this comment

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

Не хватает пунктуации между "Пример" и "как".
Чтобы не думать, что тут конкретно нужно вставить, я бы написал "Пример установки метаданных в тесте"


```typescript title="testplane.config.ts"
describe("badges", () => {
it("badge example", async ({ browser }) => {
await browser.setMeta("issueTitle", "ticket-1234");
await browser.setMeta("issueUrl", "https://example.com");
await browser.setMeta("branch", "master");

await browser.pause(3000);
});
});
```

#### Badge params

<table>
<thead>
<tr>
<td>**Имя**</td>
<td>**Тип**</td>
<td>**Описание**</td>
</tr>
</thead>
<tbody>
<tr>
<td>`title`</td>
<td>`string`</td>
<td>Обязательный параметр. Отображаемое имя бейджа.</td>
</tr>
<tr>
<td>`icon`</td>
<td>`string`</td>
<td>Опциональный параметр. Имя иконки из [GravityUI][gravity-ui-icons].</td>
</tr>
<tr>
<td>`url`</td>
<td>`string`</td>
<td>Опциональный параметр. Ссылка которая откроется при клике на бейдж.</td>
Copy link
Member

Choose a reason for hiding this comment

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

Ссылка которая откроется при клике

Пропущена запятая.

Предлагаю "Ссылка, открываемая при нажатии".

</tr>
</tbody>
</table>

### Передача параметров через CLI {#setup_by_cli}

Все параметры плагина, которые можно определить в конфиге, можно также передать в виде опций командной строки или через переменные окружения во время запуска testplane. Используйте префикс `--html-reporter-` для опций командной строки и `html_reporter_` — для переменных окружения.
Expand Down