# Running tests

When we are ready with our test suite we can run the tests. Click on **Run..** item in the main menu (or press **F6**).

![Run tests menu item](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-Lh_4AU-36jaAM8BBrDG%2F-Lh_4MS0_BVJ9fXnADzm%2Frun-tests.png?alt=media\&token=124bd4af-2836-48a7-a3a4-a361f4780655)

You get **Run Tests** modal window

![](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuDgNbkJr-wDqL_XpK_%2F-LuDraoEl3qke3IkM3Qg%2Frun-test1.png?alt=media\&token=b8734c8c-b728-4e72-b93f-7d8b655e4559)

Learn more about **"interactive mode"** option in [Interactive mode](https://docs.puppetry.app/v/3.0.0/running-tests/interactive-mode)

![](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuDgNbkJr-wDqL_XpK_%2F-LuDwc67kw2XN2115WxP%2Frun-test-interactive.png?alt=media\&token=1a2a1d70-7310-4117-be56-e35687e1c2d2)

Learn more about **"update comparison images"** option in [CSS Regression Testing](https://docs.puppetry.app/v/3.0.0/testing-techniques/css-regression-testing)

![](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuDgNbkJr-wDqL_XpK_%2F-LuDwVqpK4qT_p-dOSEy%2Frun-test-img.png?alt=media\&token=48c9f406-1856-4f80-ac3e-31b44f72f006)

### Selecting Staging Environment

The modal window allows you to select a [target environment](https://docs.puppetry.app/template):

![Choosing staging environment](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuDgNbkJr-wDqL_XpK_%2F-LuDtAiJ9peEj-JZs8Hy%2Frun-test-env.png?alt=media\&token=6660043f-08ec-411f-a609-d3d131d21026)

###

### Browser Options

We can use **Browser options** tab to adjust the runner

![Browser options tab](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-M0WbqLG9PVcvJplzuEq%2F-M0WkKBHdFuPtWbQpT6S%2Ftest-run-browser-options.png?alt=media\&token=420667ff-ad3a-4cd4-8576-d2c80fa50ed3)

On this panel we can select a browser to run the tests:<br>

![Picking up a browser](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-M0WbqLG9PVcvJplzuEq%2F-M0WfU0JBXVKfdmH6LzW%2Ftest-run-browser-options-select.png?alt=media\&token=e9f5478e-8698-489e-877b-967adf2c5a50)

Available options are:

[**Headless Chromium**](https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md) allows running [Chromium](https://en.wikipedia.org/wiki/Chromium_\(web_browser\)) in a headless/server environment. In this mode the test will run considerably faster.

[**Chromium**](https://en.wikipedia.org/wiki/Chromium_\(web_browser\)) is an open-source web browser, which is used as basis for Google Chrome browser. Puppetry downloads and uses a specific version of Chromium so its API is guaranteed to work out of the box.

[Google Chrome](https://www.google.com/chrome/) is a cross-platform web browser developed by Google.

[**Mozilla Firefox**](https://www.mozilla.org/en-US/firefox/) is a free and open-source web browser developed by the Mozilla Foundation.

**Connect to Chrome** - connecting to a running instance of Chrome

Browser-specific options:

* **DevTools** - enables Chrome DevTools in the browser
* **incognito window** - runs the tests in [private session](https://support.google.com/chrome/answer/7440301)
* **maximized** - maximizes the browser window
* **fullscreen** - switches the browser in fullscreen mode
* **ignore HTTPs errors** - tolerates HTTPs errors like invalid certificate

Besides you can manually provide any [Chromium command line options](https://peter.sh/experiments/chromium-command-line-switches/) in the textbox below.

You can also specify location of Chrome extension. Learn more [here](https://docs.puppetry.app/v/3.0.0/testing-techniques/testing-chrome-extensions)

### Connecting to Chrome

There are some cases when we need to connect to a ruining instance of chrome instead of starting a new one. For example to bypass reCaptcha we can solve it manually in Chrome and then run the tests on it.

In order to connect we need to start Chrome in command-line with remote-debugging-port parameter.

{% tabs %}
{% tab title="Windows" %}

```
start chrome.exe –remote-debugging-port=9222 --user-data-dir=remote-profile
```

{% endtab %}

{% tab title="macOS" %}

```
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir')
```

{% endtab %}

{% tab title="Linix" %}

```bash
google-chrome --remote-debugging-port=9222
```

{% endtab %}
{% endtabs %}

Next we navigate in the started browser to `http://127.0.0.1:9222/json/version`. On the page we can see a JSON object.&#x20;

![Obtaining webSocketDebuggerUrl](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-M0WbqLG9PVcvJplzuEq%2F-M0Wj7nc3h0DTS8ONH0R%2Ftest-run-browser-options-connect2.png?alt=media\&token=dfc2d276-3ffd-4f99-a8a0-2ee2dfdf5e34)

We shell copy the value of `webSocketDebuggerUrl` property. Open **Run Tests** modal window (F6), switch to **Browser options** tab and paste the saved value into **WS Endpoint** input.<br>

![Connect to chrome option](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-M0WbqLG9PVcvJplzuEq%2F-M0WkAIRZPuca9Q70hiE%2Ftest-run-browser-options-connect.png?alt=media\&token=6adc63b1-3b94-4e14-a3aa-c9a1d1e97793)

Now we can press **Run**.

### Running tests

As we press Run button the tests are sent to Jest and we have to wait for [Test Report](https://docs.puppetry.app/v/3.0.0/test-reports)

![Tests are running](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuDgNbkJr-wDqL_XpK_%2F-LuDrr1-Fk6HOv3AWxlh%2Frun-test3.png?alt=media\&token=85867f63-8136-40e9-a8e8-b2c73c1cf150)

&#x20;
