Skip to content

Commit 67d648c

Browse files
docs: describe local browsers
1 parent d655633 commit 67d648c

File tree

12 files changed

+681
-115
lines changed

12 files changed

+681
-115
lines changed

blog/local-browsers.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Запуск на локальных браузерах
3+
slug: local-browsers-intro
4+
hide_table_of_contents: false
5+
date: 2024-12-19T14:00
6+
---
7+
8+
import Admonition from "@theme/Admonition";
9+
10+
В Testplane добавлена возможность автоматической загрузки браузеров и драйверов для последующего локального запуска.
11+
12+
<!-- truncate -->
13+
14+
Раньше Testplane с протоколом автоматизации webdriver можно было запустить локально только со вручную запущенным [selenium-standalone](https://github.com/webdriverio/selenium-standalone). Теперь достаточно указать указать `gridUrl: "local"` в [Конфиге Testplane](/docs/v8/command-line) или запустить тесты с [CLI-опцией](/docs/v8/command-line) `--local`. В таком случае перед запуском тестов, при необходимости, будут загружены соответствующие браузеры и вебдрайверы к ним, которые также будут запущены для дальнейшего использования в этих тестах.
15+
16+
Загрузить браузеры и вебдрайверы к ним можно и отдельно, с помощью команды [install-deps](/docs/v8/command-line#install-deps).
17+
18+
### Как использовать?
19+
20+
Узнайте больше об этом в нашей документации [Как запустить Testplane в локальном браузере](/docs/v8/guides/local-browsers).

blog/vscode-extension.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Admonition from "@theme/Admonition";
99
import runTestsFromSidebarVideoUrl from "/video/blog/vscode-extension/run-tests-from-sidebar.mp4";
1010
import runTestsFromEditorVideoUrl from "/video/blog/vscode-extension/run-tests-from-editor.mp4";
1111

12-
Для Testplane реализовали расширение для [VS Code][vscode], с помощью которого можно настраивать Testplane с нуля, запускать тесты и удобно работать с <a href="/ru/docs/v8/command-line/#testplane-repl">REPL режимом</a>.
12+
Для Testplane реализовали расширение для [VS Code][vscode], с помощью которого можно настраивать Testplane с нуля, запускать тесты и удобно работать с <a href="/ru/docs/v8/command-line#testplane-repl">REPL режимом</a>.
1313

1414
<!-- truncate -->
1515

@@ -80,7 +80,7 @@ Install Testplane
8080

8181
#### С настройкой `REPL`
8282

83-
При клике в чекбокс `Enable REPL` и последующем запуске теста (в REPL режиме можно одновременно запустить только один тест) он будет запущен в специальном REPL режиме. Подробнее про этот режим можно прочитать <a href="/ru/docs/v8/command-line/#testplane-repl">здесь</a>.
83+
При клике в чекбокс `Enable REPL` и последующем запуске теста (в REPL режиме можно одновременно запустить только один тест) он будет запущен в специальном REPL режиме. Подробнее про этот режим можно прочитать <a href="/ru/docs/v8/command-line#testplane-repl">здесь</a>.
8484

8585
![Включение опции REPL](/img/blog/vscode-extension/enable-repl.png)
8686

docs/command-line/index.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Main command to run tests.
2929
--repl-before-test [type] open repl interface before test run (default: false)
3030
--repl-on-fail [type] open repl interface on test fail only (default: false)
3131
--devtools switches the browser to the devtools mode with using CDP protocol
32+
--local use automatically downloaded browsers and drivers, provided by Testplane
3233
-h, --help output usage information
3334
```
3435
@@ -463,6 +464,47 @@ For example, [html-reporter][html-reporter] adds `gui` command.
463464
testplane list-tests --help
464465
```
465466
467+
## `install-deps` command {#install-deps}
468+
469+
This command is a part of the guide [How to launch Testplane in the local browser](/docs/v8/guides/local-browsers).
470+
471+
Use the `install-deps` command to download all browsers, specified in [Testplane config](/docs/v8/config/main).
472+
473+
If this command is launched on supported ubuntu version, all missing necessary ubuntu packages would be downloaded too.
474+
475+
### Usage {#usage}
476+
477+
```bash
478+
npx testplane install-deps
479+
```
480+
481+
### Command Arguments {#arguments}
482+
483+
You can also specify, which browsers are need to be downloaded.
484+
485+
For example, if you have browsers "chrome-dark", "firefox-dark" described in <a href="/docs/v8/config/main">Testplane config</a>, you can use the following command to only download these two browsers:
486+
487+
```bash
488+
npx testplane install-deps chrome-dark firefox-dark
489+
```
490+
491+
Using browser names with versions in a format like `<browserName>@<browserVersion>` is also supported:
492+
493+
```bash
494+
npx testplane install-deps chrome@130 firefox@104
495+
```
496+
497+
### Installation Directory {#directory}
498+
499+
By default, browsers and drivers are downloaded to ".testplane" directory at home directory.
500+
501+
You can specify other path by setting `TESTPLANE_BROWSERS_PATH` env variable:
502+
503+
```bash
504+
TESTPLANE_BROWSERS_PATH=./node_modules/.testplane npx testplane install-deps
505+
TESTPLANE_BROWSERS_PATH=~/.testplane npx testplane install-deps
506+
```
507+
466508
## Overriding settings {#overriding-settings}
467509
468510
All options can be overridden via command-line flags or environment variables with the following priorities, by descending:

docs/config/browsers.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ Grid URL (the address where ChromeDriver/Selenium Standalone/Sauce Labs/etc. lis
134134

135135
Default: `http://localhost:4444/wd/hub`.
136136

137+
<Admonition type="info">
138+
You can also use value `"local"` in order to use automatic local browsres, managed by Testplane.
139+
Read more in guide [How to launch Testplane in the local
140+
browser](/docs/v8/guides/local-browsers).
141+
</Admonition>
142+
137143
### baseUrl {#base_url}
138144

139145
Base URL of the service being tested. Allows for more convenient use of the `browser.url` commands:

docs/guides/local-browsers.mdx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import Admonition from "@theme/Admonition";
2+
3+
# How to Run Testplane in a Local Browser
4+
5+
## Introduction
6+
7+
Testplane allows for the automatic downloading of browsers and web drivers as specified in the [Testplane Config](/docs/v8/config/main).
8+
9+
Additionally, if Testplane is used on a supported version of Ubuntu, the necessary deb packages for running browsers will also be downloaded in a similar manner.
10+
11+
## Installing Dependencies
12+
13+
In a project with Testplane, you can execute the command `npx testplane install-deps`. This command will download the necessary browsers (`chrome` and `firefox`) and their web drivers (`chrome`, `firefox`, and `edge`).
14+
15+
You can read more about this command on the respective page: [install-deps](/docs/v8/command-line#install-deps)
16+
17+
## Running Tests
18+
19+
You can run tests on local browsers using the [CLI option](/docs/v8/command-line) `--local`, or with [gridUrl](/docs/v8/config/browsers/#grid_url): "local" in the [Testplane config](/docs/v8/config/main). For example:
20+
21+
```bash
22+
npx testplane --local
23+
```
24+
25+
This way, the corresponding web driver processes for supported browsers will be automatically started, and Testplane will use these locally launched drivers with locally downloaded browsers.
26+
27+
If necessary, browsers will be downloaded before the test run, so running the `install-deps` command separately is not mandatory, especially if you want to quickly run a test in just one browser.
28+
29+
## Debugging Tests
30+
31+
When `debug` is enabled in the config, web driver logs with a prefix will be output to stdout/stderr:
32+
33+
```javascript
34+
// other Testplane settings
35+
system: {
36+
debug: true,
37+
}
38+
```
39+
40+
To reduce excessive `webdriverio` logs, you can set the desired level for the `WDIO_LOG_LEVEL` environment variable.
41+
42+
For example, here's how a launch would look with debugging enabled via an environment variable, `webdriverio` logging level set to `error` in a local browser with browserId `chrome` in the config:
43+
44+
```bash
45+
testplane_system_debug=true WDIO_LOG_LEVEL=error npx testplane --local -b chrome
46+
```
47+
48+
And the web driver logs will look something like this:
49+
50+
```plaintext
51+
$ testplane_system_debug=true WDIO_LOG_LEVEL=error npx testplane --local -b chrome
52+
[chromedriver@130] Starting ChromeDriver 130.0.6723.116 (6ac35f94ae3d01152cf1946c896b0678e48f8ec4-refs/branch-heads/6723@{#1764}) on port 43415
53+
[chromedriver@130] Only local connections are allowed.
54+
[chromedriver@130] Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
55+
[chromedriver@130] ChromeDriver was started successfully on port 43415.
56+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Running on Local Browsers
3+
slug: local-browsers-intro
4+
hide_table_of_contents: false
5+
date: 2024-12-19T14:00
6+
---
7+
8+
import Admonition from "@theme/Admonition";
9+
10+
Testplane now has the ability for automatic downloading of browsers and drivers for subsequent local browser test launches.
11+
12+
<!-- truncate -->
13+
14+
Previously, Testplane with the webdriver automation protocol could only be launched locally with a manually started [selenium-standalone](https://github.com/webdriverio/selenium-standalone). Now, it is enough to specify `gridUrl: "local"` in the [Testplane Config](/docs/v8/config/main) or run tests with the [CLI option](/docs/v8/command-line) `--local`. In this case, if necessary, the corresponding browsers and web drivers will be downloaded before running the tests, and they will also be launched for further use in these tests.
15+
16+
You can also download the browsers and their web drivers separately using the [install-deps](/docs/v8/command-line#install-deps) command.
17+
18+
### How to use?
19+
20+
Learn more about this in our documentation [How to Run Testplane in a Local Browser](/docs/v8/guides/local-browsers).

i18n/en/docusaurus-plugin-content-blog/vscode-extension.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Admonition from "@theme/Admonition";
99
import runTestsFromSidebarVideoUrl from "/video/blog/vscode-extension/run-tests-from-sidebar.mp4";
1010
import runTestsFromEditorVideoUrl from "/video/blog/vscode-extension/run-tests-from-editor.mp4";
1111

12-
We have implemented an extension for [VS Code][vscode] for Testplane, which allows you to configure Testplane from scratch, run tests, and conveniently work with the <a href="/ru/docs/v8/command-line/#testplane-repl">REPL mode</a>.
12+
We have implemented an extension for [VS Code][vscode] for Testplane, which allows you to configure Testplane from scratch, run tests, and conveniently work with the <a href="/ru/docs/v8/command-line#testplane-repl">REPL mode</a>.
1313

1414
<!-- truncate -->
1515

@@ -80,7 +80,7 @@ In the sidebar of the testing panel, there is also a section titled Testplane. H
8080

8181
#### With the `REPL` settings
8282

83-
When you click the checkbox `Enable REPL` and subsequently run a test (only one test can be run simultaneously in REPL mode), it will be launched in a special REPL mode. You can read more about this mode <a href="/ru/docs/v8/command-line/#testplane-repl">here</a>.
83+
When you click the checkbox `Enable REPL` and subsequently run a test (only one test can be run simultaneously in REPL mode), it will be launched in a special REPL mode. You can read more about this mode <a href="/ru/docs/v8/command-line#testplane-repl">here</a>.
8484

8585
![Enabling the REPL option](/img/blog/vscode-extension/enable-repl.png)
8686

i18n/ru/docusaurus-plugin-content-docs/current.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
},
5858
"sidebar.mainSidebar.doc.CLI": {
5959
"message": "CLI",
60-
"description": "The label for the doc item Command Line in sidebar mainSidebar, linking to the doc command-line/index"
60+
"description": "The label for the doc item Command Line in sidebar mainSidebar, linking to the doc command-line"
6161
}
6262
}

0 commit comments

Comments
 (0)