-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Add info about Chrome-specific features #1513
[docs] Add info about Chrome-specific features #1513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* **cdpPort=\<int\>** - an open port used for the Chrome Debugging Protocol. | ||
* **cmdArgs** - command line [arguments](../command-line-interface.html#starting-browser-with-arguments) that are passed to the chrome. | ||
|
||
> The CDP requires an open port to work. TestCafe automatically selects an open port, but you can define a custom port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO 'free port' is more suitable here.
@@ -99,6 +100,25 @@ You can also use the [--qr-code](#--qr-code) option to display QR-codes that rep | |||
Scan the QR-codes by using the device on which you are going to test your application. | |||
As a result, the browsers will be connected to TestCafe and tests will start. | |||
|
|||
### Using Chrome-specific Features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be referenced in "Local Browsers" section
testcafe "chrome:headless" tests/sample-fixture.js | ||
``` | ||
|
||
You can specify a custom port for CDP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why I need to do that? Can we point to the CDP docs or smthg for those who don't familiar with protocol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about CDP, it's about a network configuration on your machine, e.g. available ports numbers are whitelisted in your firewall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This basically justifies my request: I have no idea what's it for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should write something like We use Chrome Debugging Protocol to enable this features. It's required an available port to work with it. You can set the port via ... If the custom port is not specified, then TestCafe automatically assigns a free port.
And provide with some proof link
testcafe "chrome:headless:cdpPort=9223" tests/sample-fixture.js | ||
``` | ||
|
||
Note that headless mode is available for Mac and Linux in Chrome 59. You need a [Canary build](https://www.google.com/chrome/browser/canary.html) to enable headless mode on Windows. Specify a path to installation location, if you install a portable version of Chrome: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a special decoration styles for notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's break this into 2 parts:
The headless mode is available for Mac and Linux in Chrome 59. You need a Canary build to enable headless mode on Windows.
Specify a path to installation location, if you install a portable version of Chrome:
|
||
You can run test in Chrome's built-in [device emulator](https://developers.google.com/web/tools/chrome-devtools/device-mode/): | ||
|
||
```sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For two separate examples we need two separate code blocks, otherwise it looks like I need to run both commands to make this functionality work.
Options: | ||
|
||
* **pathToBrowser** - specifies a path to a portable browser. The path to browser is not required, if it is installed in a system. | ||
* **headless** - Chrome runs in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enables "headless mode"
* **emulation** - allows you to run tests in Chrome [device emulator](https://developers.google.com/web/tools/chrome-devtools/device-mode/). | ||
* **chrome arguments** - options separated by `;`. The following arguments are available: | ||
* **device parameters**: | ||
* **device=\<string\>** - the emulated device; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where can I find the list of available device names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can look for them in DevTools. Open DevTools -> ⠇->Settings -> Devices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a rhetoric question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
device=<string> - the emulated device (see the full list of supported devices in DevTools -> ⠇->Settings -> Devices);
* **mobile=\<bool\>** - whether to emulate a mobile device; | ||
* **orientation=\<vertical|horizontal\>** - the device orientation; | ||
* **userAgent=\<string\>** - the user agent string; | ||
* **touch=\<bool\>** - whether the touch support is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"enables touch support"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enables or disables touch support
* **cdpPort=\<int\>** - a free port used for the Chrome Debugging Protocol. | ||
* **cmdArgs** - command line [arguments](../command-line-interface.html#starting-browser-with-arguments) that are passed to the chrome. | ||
|
||
> The CDP requires a free port to work. TestCafe automatically selects a free port, but you can define a custom port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If the custom port is not specified, then TestCafe automatically assigns a free port."
* **chrome arguments** - options separated by `;`. The following arguments are available: | ||
* **device parameters**: | ||
* **device=\<string\>** - the emulated device; | ||
* **width=\<number\>** - the device screen width in pixels; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a table (like we use in other API descriptions) with property type and defaults values, instead of this notation?
* **userAgent=\<string\>** - the user agent string; | ||
* **touch=\<bool\>** - whether the touch support is enabled. | ||
* **CDP arguments**: | ||
* **cdpPort=\<int\>** - a free port used for the Chrome Debugging Protocol. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int
here? Can I specify `-13371337" as a port number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure it's obvious what ints we do mean :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, first of all it's inconsistent: we use "Number" everywhere (there is no such thing as "int" in JS). Also, we usually specify valid range for port number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdpPort=<number> - a free port (0-65535) used for the Chrome Debugging Protocol.
FPR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs improvements
`height` *(optional)* | Number | The device screen height in pixels. | No default value. If the device height is not set specify the emulated device name the `device` property. | ||
`scaleFactor` *(optional)* | Number | Device scale factor value. | `1` | ||
`mobile` *(optional)* | Boolean | Whether to emulate a mobile device. | `true` if a mobile device is set via the device property. Otherwise `false`. | ||
`device` *(optional)* | String | The emulated device name (see the full list of supported devices in DevTools -> ⠇->Settings -> Devices). | No default value. If the device name is not set specify the custom device parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify the custom device parameters, if the device name is not set.
`scaleFactor` *(optional)* | Number | Device scale factor value. | `1` | ||
`mobile` *(optional)* | Boolean | Whether to emulate a mobile device. | `true` if a mobile device is set via the device property. Otherwise `false`. | ||
`device` *(optional)* | String | The emulated device name (see the full list of supported devices in DevTools -> ⠇->Settings -> Devices). | No default value. If the device name is not set specify the custom device parameters. | ||
`width` *(optional)* | Number | The device screen width in pixels. | No default value. If the device width is not set specify the emulated device name via the `device` property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify the emulated device name using the device
property, if the device width is not set.
`mobile` *(optional)* | Boolean | Whether to emulate a mobile device. | `true` if a mobile device is set via the device property. Otherwise `false`. | ||
`device` *(optional)* | String | The emulated device name (see the full list of supported devices in DevTools -> ⠇->Settings -> Devices). | No default value. If the device name is not set specify the custom device parameters. | ||
`width` *(optional)* | Number | The device screen width in pixels. | No default value. If the device width is not set specify the emulated device name via the `device` property. | ||
`height` *(optional)* | Number | The device screen height in pixels. | No default value. If the device height is not set specify the emulated device name via the `device` property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify the emulated device name using the device
property, if the device height is not set.
`device` *(optional)* | String | The emulated device name (see the full list of supported devices in DevTools -> ⠇->Settings -> Devices). | No default value. If the device name is not set specify the custom device parameters. | ||
`width` *(optional)* | Number | The device screen width in pixels. | No default value. If the device width is not set specify the emulated device name via the `device` property. | ||
`height` *(optional)* | Number | The device screen height in pixels. | No default value. If the device height is not set specify the emulated device name via the `device` property. | ||
`scaleFactor` *(optional)* | Number | Device scale factor value. | Depends on chosen `device` or your system parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on a chosen device
or your system parameters.
`width` *(optional)* | Number | The device screen width in pixels. | No default value. If the device width is not set specify the emulated device name via the `device` property. | ||
`height` *(optional)* | Number | The device screen height in pixels. | No default value. If the device height is not set specify the emulated device name via the `device` property. | ||
`scaleFactor` *(optional)* | Number | Device scale factor value. | Depends on chosen `device` or your system parameters. | ||
`mobile` *(optional)* | Boolean | Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more. | `true` if a mobile device is set via the `device` property. Otherwise `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether to emulate a mobile device. This includes the viewport meta tag, overlay scrollbars, text autosizing and more. | true
if a mobile device is set via the device
property. Otherwise false
.
`userAgent` *(optional)* | String | The user agent string | Default browser's user agent string | ||
`touch` *(optional)* | Boolean | Enables or disables touch support | `true` if a touch-supported device is set via the device property. Otherwise `false`. | ||
`userAgent` *(optional)* | String | The user agent string | The user agent string of the selected `device` or the browser. | ||
`touch` *(optional)* | Boolean | Enables or disables touch event emulation. | `true` if a touch-supported device is set via the `device` property or your system supports touch events. Otherwise `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enables or disables the touch event emulation. | true
if a touch-supported device is set via the device
property or your system supports touch events. Otherwise false
.
FPR |
/cc @lexkazakov @DevExpress/testcafe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
```sh | ||
testcafe "chrome:path/to/chrome:headless" tests/sample-fixture.js | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the headless mode the browser's viewport size is
1280x800
by default. You can change it via the (ResizeWindow)[../../test-api/actions/resize-window.html] command or via Device Emulation Mode parameters.
/cc @lexkazakov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In headless mode the browser's viewport size is 1280x800 by default. You can change it via the (ResizeWindow)[../../test-api/actions/resize-window.html] command or via Device Emulation Mode parameters.
* [docs] Add info about Chrome-specific features * use node v7 * open port -> free port * Reworked * Update cdp arguments description * Fix tests * Small update * One more small update * Remarks * Add viewport size in headless mode info
/cc @lexkazakov @DevExpress/testcafe