You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve handling of connection with remote browser using Puppeteer (#1402)
* Disconnect from remote browser instead of terminating running instance.
* Ensure clean session on remote browser by closing any open pages once connected to endpoint.
* Abort running of tests when connection with remote browser was lost.
* Display error message when unable to connect with remote browser.
* Update Puppeteer helper documentation for connecting with remote browser using websocket.
* Restored 'test-helpers' service in order to easily run helper tests locally in Docker.
* Added tests to cover Puppeteer helper behavior when connected to remote browser.
* Rely on protocol error when connection was lost instead of listening for 'disconnected' event.
Considering it is not possible to unbind event handler using '.off' until node version 10.
* Move tests for remote browser behavior to main Puppeteer test file.
Avoiding unnecessary multiple execution of unit/runner tests with Puppeteer helper.
Copy file name to clipboardExpand all lines: docs/helpers/Puppeteer.md
+25-16Lines changed: 25 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
**Extends Helper**
6
6
7
7
Uses [Google Chrome's Puppeteer][1] library to run tests inside headless Chrome.
8
-
Browser control is executed via DevTools without Selenium.
8
+
Browser control is executed via DevTools Protocol (instead of Selenium).
9
9
This helper works with a browser out of the box with no additional tools required to install.
10
10
11
11
Requires `puppeteer` package to be installed.
@@ -27,10 +27,9 @@ This helper should be configured in codecept.json or codecept.conf.js
27
27
-`getPageTimeout` (optional, default: '0') config option to set maximum navigation time in milliseconds.
28
28
-`waitForTimeout`: (optional) default wait\* timeout in ms. Default: 1000.
29
29
-`windowSize`: (optional) default window size. Set a dimension like `640x480`.
30
-
-`WSEndpoint`: (optional) Chrome websocket URL to use remote browser
31
30
-`userAgent`: (optional) user-agent string.
32
31
-`manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
33
-
-`chrome`: (optional) pass additional [Puppeteer run options][3]. Example
32
+
-`chrome`: (optional) pass additional [Puppeteer run options][3].
34
33
35
34
#### Example #1: Wait for 0 network connections.
36
35
@@ -75,15 +74,23 @@ This helper should be configured in codecept.json or codecept.conf.js
75
74
}
76
75
```
77
76
78
-
#### Example #4: Using remote WS endpoint
77
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][4]
* * `windowSize`: (optional) default window size. Set a dimension like `640x480`.
57
-
* * `WSEndpoint`: (optional) Chrome websocket URL to use remote browser
58
58
* * `userAgent`: (optional) user-agent string.
59
59
* * `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
60
-
* * `chrome`: (optional) pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). Example
60
+
* * `chrome`: (optional) pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
61
61
*
62
62
*
63
63
* #### Example #1: Wait for 0 network connections.
@@ -103,14 +103,22 @@ const consoleLogStore = new Console();
103
103
* }
104
104
* ```
105
105
*
106
-
* #### Example #4: Using remote WS endpoint
106
+
* #### Example #4: Connect to remote browser by specifying [websocket endpoint](https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target)
0 commit comments