|
| 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/main) `--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 | +``` |
0 commit comments