-
Notifications
You must be signed in to change notification settings - Fork 3
Badges #100
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
Badges #100
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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"; | ||
|
|
@@ -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> | ||
|
|
||
| </tbody> | ||
| </table> | ||
|
|
@@ -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. | ||
|
||
|
|
||
| ```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. | ||
|
|
@@ -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,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"; | ||
|
|
@@ -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> | ||
|
||
|
|
||
| </tbody> | ||
| </table> | ||
|
|
@@ -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" /> | ||
|
|
||
| Колбэк, который вызывается после каждого запуска теста. Он получает результат теста и возвращает список бейджей. | ||
|
||
|
|
||
| Пример использования: здесь мы задаём название тикета и URL, название ветки. | ||
|
||
|
|
||
| ```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', | ||
| }, | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Пример как можно установить метаданные в тесте. | ||
|
||
|
|
||
| ```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> | ||
|
||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| ### Передача параметров через CLI {#setup_by_cli} | ||
|
|
||
| Все параметры плагина, которые можно определить в конфиге, можно также передать в виде опций командной строки или через переменные окружения во время запуска testplane. Используйте префикс `--html-reporter-` для опций командной строки и `html_reporter_` — для переменных окружения. | ||
|
|
||
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.
Callback is called "generateBadge", but anchor is still "#badgeformatter"