|
| 1 | +import Admonition from "@theme/Admonition"; |
| 2 | + |
| 3 | +# How to Run Testplane in a Local Browser |
| 4 | + |
| 5 | +## Introduction |
| 6 | + |
| 7 | +Testplane can automatically download browsers in accordance with your [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 | +Running tests on a local browser can help with troubleshooting a problem that occurs when running on a remote grid, but using local browsers for screenshot testing is not recommended, as screenshots will vary depending on the operating system version. |
| 12 | + |
| 13 | +## Installing dependencies |
| 14 | + |
| 15 | +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`). |
| 16 | + |
| 17 | +You can also download only the necessary browsers described in the config. For example, if the browser `chrome-dark` is described, you can download only this one with the command `npm testplane install-deps chrome-dark'. |
| 18 | + |
| 19 | +You can read more about this command on the respective page: [install-deps](/docs/v8/command-line#install-deps) |
| 20 | + |
| 21 | +## Running tests |
| 22 | + |
| 23 | +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: |
| 24 | + |
| 25 | +```bash |
| 26 | +npx testplane --local |
| 27 | +``` |
| 28 | + |
| 29 | +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. |
| 30 | + |
| 31 | +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. |
| 32 | + |
| 33 | +## Debugging tests |
| 34 | + |
| 35 | +When `debug` is enabled in the config, web driver logs with a prefix will be output to stdout/stderr: |
| 36 | + |
| 37 | +```typescript |
| 38 | +export default { |
| 39 | + // ... other Testplane settings |
| 40 | + system: { |
| 41 | + debug: true, |
| 42 | + }, |
| 43 | +}; |
| 44 | +``` |
| 45 | + |
| 46 | +To reduce excessive `webdriverio` logs, you can set the desired level for the `WDIO_LOG_LEVEL` environment variable. |
| 47 | + |
| 48 | +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: |
| 49 | + |
| 50 | +```bash |
| 51 | +testplane_system_debug=true WDIO_LOG_LEVEL=error npx testplane --local -b chrome |
| 52 | +``` |
| 53 | + |
| 54 | +And the web driver logs will look something like this: |
| 55 | + |
| 56 | +```plaintext |
| 57 | +$ testplane_system_debug=true WDIO_LOG_LEVEL=error npx testplane --local -b chrome |
| 58 | +[chromedriver@130] Starting ChromeDriver 130.0.6723.116 (6ac35f94ae3d01152cf1946c896b0678e48f8ec4-refs/branch-heads/6723@{#1764}) on port 43415 |
| 59 | +[chromedriver@130] Only local connections are allowed. |
| 60 | +[chromedriver@130] Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. |
| 61 | +[chromedriver@130] ChromeDriver was started successfully on port 43415. |
| 62 | +``` |
| 63 | + |
| 64 | +## Browser support {#browser-support} |
| 65 | + |
| 66 | +Here is the table of supported browsers: |
| 67 | + |
| 68 | +| Browser | Auto download | Auto driver download | Running webdriver | |
| 69 | +| ------- | ------------- | -------------------- | ----------------- | |
| 70 | +| Chrome | + | + | + | |
| 71 | +| Firefox | + | + | + | |
| 72 | +| Edge | - | + | + | |
| 73 | +| Safari | - | + | + | |
| 74 | + |
| 75 | +Supported browser versions per OS: |
| 76 | + |
| 77 | +| OS | Windows | MacOs | Ubuntu 20 | Ubuntu 22 | Ubuntu 24 | |
| 78 | +| :-----: | ------- | ----- | --------- | --------- | --------- | |
| 79 | +| Chrome | 73+ | 73+ | 73+ | 73+ | 73+ | |
| 80 | +| Firefox | 60+ | 60+ | 60+ | 91+ | 126+ | |
| 81 | +| Edge | \* | \* | \* | \* | \* | |
| 82 | +| Safari | - | \* | - | - | - | |
| 83 | + |
| 84 | +- - Browser auto download is not supported, but if the browser is installed by the user himself, installed version will be used by Testplane. |
| 85 | + |
| 86 | +For virtual environments, you would need to run headless. "--no-sandbox" CLI arg for "chrome" browser could also be necessary: |
| 87 | + |
| 88 | +```typescript |
| 89 | +{ |
| 90 | + // other chrome browser settings |
| 91 | + headless: true, |
| 92 | + desiredCapabilities: { |
| 93 | + browserName: "chrome", |
| 94 | + browserVersion: "130.0", |
| 95 | + "goog:chromeOptions": { args: ["--no-sandbox"] } |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
0 commit comments