Skip to content

Commit

Permalink
[docs] Add a description for new option, and reorder other cli options (
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaritaLoseva authored and AndreyBelym committed Aug 17, 2018
1 parent ac21fdb commit 19fd15d
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 61 deletions.
135 changes: 74 additions & 61 deletions docs/articles/documentation/using-testcafe/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,26 @@ testcafe [options] <browser-list-comma-separated> <file-or-glob ...>
* [-S, --screenshots-on-fails](#-s---screenshots-on-fails)
* [-p, --screenshot-path-pattern](#-p---screenshot-path-pattern)
* [-q, --quarantine-mode](#-q---quarantine-mode)
* [-d, --debug-mode](#-d---debug-mode)
* [-e, --skip-js-errors](#-e---skip-js-errors)
* [-c \<n\>, --concurrency \<n\>](#-c-n---concurrency-n)
* [-u, --skip-uncaught-errors](#-u---skip-uncaught-errors)
* [-t \<name\>, --test \<name\>](#-t-name---test-name)
* [-T \<pattern\>, --test-grep \<pattern\>](#-t-pattern---test-grep-pattern)
* [-f \<name\>, --fixture \<name\>](#-f-name---fixture-name)
* [-F \<pattern\>, --fixture-grep \<pattern\>](#-f-pattern---fixture-grep-pattern)
* [-a \<command\>, --app \<command\>](#-a-command---app-command)
* [-d, --debug-mode](#-d---debug-mode)
* [-c \<n\>, --concurrency \<n\>](#-c-n---concurrency-n)
* [--debug-on-fail](#--debug-on-fail)
* [--app-init-delay \<ms\>](#--app-init-delay-ms)
* [--selector-timeout \<ms\>](#--selector-timeout-ms)
* [--assertion-timeout \<ms\>](#--assertion-timeout-ms)
* [--page-load-timeout \<ms\>](#--page-load-timeout-ms)
* [--proxy \<host\>](#--proxy-host)
* [--proxy-bypass \<rules\>](#--proxy-bypass-rules)
* [--speed \<factor\>](#--speed-factor)
* [--ports \<port1,port2\>](#--ports-port1port2)
* [--hostname \<name\>](#--hostname-name)
* [--proxy \<host\>](#--proxy-host)
* [--ssl \<options\>](#--ssl-options)
* [--speed \<factor\>](#--speed-factor)
* [--proxy-bypass \<rules\>](#--proxy-bypass-rules)
* [--dev](#--dev)
* [--qr-code](#--qr-code)
* [--color](#--color)
Expand Down Expand Up @@ -336,6 +337,19 @@ Enables the [quarantine mode](programming-interface/runner.md#quarantine-mode) f
testcafe all tests/sample-fixture.js -q
```

### -d, --debug-mode

Specify this option to run tests in the debugging mode. In this mode, test execution is paused before the first action or assertion allowing you to invoke the developer tools and debug.

The footer displays a status bar in which you can resume test execution or skip to the next action or assertion.

![Debugging status bar](../../images/debugging/client-debugging-footer.png)

> If the test you run in the debugging mode contains a [test hook](../test-api/test-code-structure.md#test-hooks),
> it is paused within this hook before the first action.
You can also use the **Unlock page** switch in the footer to unlock the tested page and interact with its elements.

### -e, --skip-js-errors

When a JavaScript error occurs on a tested web page, TestCafe stops test execution and posts an error message to a report. To ignore JavaScript errors, use the `-e`(`--skip-js-errors`) option.
Expand All @@ -346,19 +360,16 @@ For example, the following command runs tests from the specified file and forces
testcafe ie tests/sample-fixture.js -e
```

### -c \<n\>, --concurrency \<n\>

Specifies that tests should run concurrently.
### -u, --skip-uncaught-errors

TestCafe opens `n` instances of the same browser and creates a pool of browser instances.
Tests are run concurrently against this pool, that is, each test is run in the first free instance.
When an uncaught error or unhandled promise rejection occurs on the server during test execution, TestCafe stops the test and posts an error message to a report. Note that if you run tests [concurrently](#-c-n---concurrency-n) and such an error occurs in any test, all tests that are running at this moment will fail.

See [Concurrent Test Execution](common-concepts/concurrent-test-execution.md) for more information about concurrent test execution.
To ignore these errors, use the `-u`(`--skip-uncaught-errors`) option.

The following example shows how to run tests in three Chrome instances:
For example, the following command runs tests from the specified file and forces TestCafe to ignore uncaught errors and unhandled promise rejections:

```sh
testcafe -c 3 chrome tests/sample-fixture.js
testcafe ie tests/sample-fixture.js -u
```

### -t \<name\>, --test \<name\>
Expand Down Expand Up @@ -413,18 +424,20 @@ testcafe chrome my-tests --app "node server.js"
Use the [--app-init-delay](#--app-init-delay-ms) option to specify the amount of time allowed for this command to initialize the tested application.

### -d, --debug-mode
### -c \<n\>, --concurrency \<n\>

Specify this option to run tests in the debugging mode. In this mode, test execution is paused before the first action or assertion allowing you to invoke the developer tools and debug.
Specifies that tests should run concurrently.

The footer displays a status bar in which you can resume test execution or skip to the next action or assertion.
TestCafe opens `n` instances of the same browser and creates a pool of browser instances.
Tests are run concurrently against this pool, that is, each test is run in the first free instance.

![Debugging status bar](../../images/debugging/client-debugging-footer.png)
See [Concurrent Test Execution](common-concepts/concurrent-test-execution.md) for more information about concurrent test execution.

> If the test you run in the debugging mode contains a [test hook](../test-api/test-code-structure.md#test-hooks),
> it is paused within this hook before the first action.
The following example shows how to run tests in three Chrome instances:

You can also use the **Unlock page** switch in the footer to unlock the tested page and interact with its elements.
```sh
testcafe -c 3 chrome tests/sample-fixture.js
```

### --debug-on-fail

Expand Down Expand Up @@ -485,61 +498,52 @@ You can set the page load timeout to `0` to skip waiting for the `window.load` e
testcafe ie my-tests --page-load-timeout 0
```

### --proxy \<host\>
### --speed \<factor\>

Specifies the proxy server used in your local network to access the Internet.
Specifies the test execution speed.

```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com
```
Tests are run at the maximum speed by default. You can use this option
to slow the test down.

`factor` should be a number between `1` (the fastest) and `0.01` (the slowest).

```sh
testcafe chrome my-tests/**/*.js --proxy 172.0.10.10:8080
testcafe chrome my-tests --speed 0.1
```

You can also specify authentication credentials with the proxy host.
If the speed is also specified for an [individual action](../test-api/actions/action-options.md#basic-action-options), the action's speed setting overrides the test speed.

```js
testcafe chrome my-tests/**/*.js --proxy username:password@proxy.mycorp.com
```
**Default value**: `1`

### --proxy-bypass \<rules\>
### --ports \<port1,port2\>

Specifies the resources accessed bypassing the proxy server.
Specifies custom port numbers TestCafe uses to perform testing. The number range is [0-65535].

When you access the Internet through a proxy server specified using the [--proxy](#--proxy-host) option, you may still need some local or external resources to be accessed directly. In this instance, provide their URLs to the `--proxy-bypass` option.
TestCafe automatically selects ports if ports are not specified.

The `rules` parameter takes a comma-separated list (without spaces) of URLs that require direct access. You can replace parts of the URL with the `*` wildcard that matches any number of characters. Wildcards at the beginning and end of the rules can be omitted (`*.mycompany.com` and `.mycompany.com` have the same effect).
### --hostname \<name\>

The following example uses the proxy server at `proxy.corp.mycompany.com` with the `localhost:8080` address accessed directly:
Specifies your computer's hostname. It is used when running tests in [remote browsers](#remote-browsers).

```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass localhost:8080
```
If the hostname is not specified, TestCafe uses the operating system's hostname or the current machine's network IP address.

In the example below, two resources are accessed by bypassing the proxy: `localhost:8080` and `internal-resource.corp.mycompany.com`.
### --proxy \<host\>

Specifies the proxy server used in your local network to access the Internet.

```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass localhost:8080,internal-resource.corp.mycompany.com
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com
```

The `*.mycompany.com` value means that all URLs in the `mycompany.com` subdomains are accessed directly.

```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass *.mycompany.com
testcafe chrome my-tests/**/*.js --proxy 172.0.10.10:8080
```

### --ports \<port1,port2\>

Specifies custom port numbers TestCafe uses to perform testing. The number range is [0-65535].

TestCafe automatically selects ports if ports are not specified.

### --hostname \<name\>

Specifies your computer's hostname. It is used when running tests in [remote browsers](#remote-browsers).
You can also specify authentication credentials with the proxy host.

If the hostname is not specified, TestCafe uses the operating system's hostname or the current machine's network IP address.
```js
testcafe chrome my-tests/**/*.js --proxy username:password@proxy.mycorp.com
```

### --ssl \<options\>

Expand All @@ -558,22 +562,31 @@ Provide the `--ssl` flag if the tested webpage uses browser features that requir
secure origin ([Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), [ApplePaySession](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession), [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto), etc).
See [Connect to the TestCafe Server over HTTPS](common-concepts/connect-to-the-testcafe-server-over-https.md) for more information.

### --speed \<factor\>
### --proxy-bypass \<rules\>

Specifies the test execution speed.
Specifies the resources accessed bypassing the proxy server.

Tests are run at the maximum speed by default. You can use this option
to slow the test down.
When you access the Internet through a proxy server specified using the [--proxy](#--proxy-host) option, you may still need some local or external resources to be accessed directly. In this instance, provide their URLs to the `--proxy-bypass` option.

`factor` should be a number between `1` (the fastest) and `0.01` (the slowest).
The `rules` parameter takes a comma-separated list (without spaces) of URLs that require direct access. You can replace parts of the URL with the `*` wildcard that matches any number of characters. Wildcards at the beginning and end of the rules can be omitted (`*.mycompany.com` and `.mycompany.com` have the same effect).

The following example uses the proxy server at `proxy.corp.mycompany.com` with the `localhost:8080` address accessed directly:

```sh
testcafe chrome my-tests --speed 0.1
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass localhost:8080
```

If the speed is also specified for an [individual action](../test-api/actions/action-options.md#basic-action-options), the action's speed setting overrides the test speed.
In the example below, two resources are accessed by bypassing the proxy: `localhost:8080` and `internal-resource.corp.mycompany.com`.

**Default value**: `1`
```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass localhost:8080,internal-resource.corp.mycompany.com
```

The `*.mycompany.com` value means that all URLs in the `mycompany.com` subdomains are accessed directly.

```sh
testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass *.mycompany.com
```

### --dev

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ You can pass the following options to the `runner.run` function.
Parameter | Type | Description | Default
----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------
`skipJsErrors` | Boolean | Defines whether to continue running a test after a JavaScript error occurs on a page (`true`), or consider such a test failed (`false`). | `false`
`skipUncaughtErrors` | Boolean | Defines whether to continue running a test after an uncaught error or unhandled promise rejection occurs on the server (`true`), or consider such a test failed (`false`). | `false`
`quarantineMode` | Boolean | Defines whether to enable the [quarantine mode](#quarantine-mode). | `false`
`selectorTimeout` | Number | Specifies the time (in milliseconds) within which [selectors](../../test-api/selecting-page-elements/selectors/README.md) make attempts to obtain a node to be returned. See [Selector Timeout](../../test-api/selecting-page-elements/selectors/using-selectors.md#selector-timeout). | `10000`
`assertionTimeout` | Number | Specifies the time (in milliseconds) within which TestCafe makes attempts to successfully execute an [assertion](../../test-api/assertions/README.md) if [a selector property](../../test-api/selecting-page-elements/selectors/using-selectors.md#define-assertion-actual-value) or a [client function](../../test-api/obtaining-data-from-the-client/README.md) was passed as an actual value. See [Smart Assertion Query Mechanism](../../test-api/assertions/README.md#smart-assertion-query-mechanism). | `3000`
Expand Down

0 comments on commit 19fd15d

Please sign in to comment.