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
Copy file name to clipboardexpand all lines: API.md
+9-17
Original file line number
Diff line number
Diff line change
@@ -26,32 +26,24 @@ module.exports = {
26
26
27
27
## QTap browser interface
28
28
29
-
Browsers are defined by implementing a launcher function with the following signature. Launchers are either an async function, or a function that returns a Promise.
29
+
You can define a browser launcher by implementing a function with the following signature. These launchers should either be async functions, or functions that return a Promise.
30
30
31
31
```js
32
32
/**
33
-
* A browser launcher is responsible for knowing whether the process failed to
34
-
* launch or spawn, and whether it exited unexpectedly.
33
+
* A browser launcher is responsible for opening a URL in the browser.
35
34
*
36
-
* A launcher is not responsible for knowing whether it succeeded in
37
-
* opening or navigating to the given URL.
35
+
* A launcher is not responsible for knowing whether the browser succeeded in
36
+
* opening or navigating to this URL.
38
37
*
39
-
* It is the responsiblity of ControlServer to send the "abort" event
40
-
* to AbortSignal if it believes the browser has failed to load the
41
-
* URL within a reasonable timeout, or if the browser has not sent
42
-
* any message for a while.
43
-
*
44
-
* If a browser exits on its own (i.e. ControlServer did not call send
45
-
* an abort signal), then launch() should throw an Error or reject its
46
-
* returned Promise.
38
+
* If a browser crashes or otherwise exits unexpectedly,
39
+
* you should throw an Error or reject your returned Promise.
47
40
*
48
41
* @param{string}url
49
42
* URL that the browser should navigate to, HTTP or HTTPS.
50
43
* @param{AbortSignal}signal
51
-
* The launched browser process must be terminated when this signal
52
-
* receives an "abort" event. QTap sends the abort event when it finds that
53
-
* a test has finished, or if it needs to stop the browser for any other
54
-
* reason.
44
+
* The browser process must be terminated when this signal receives an "abort" event.
45
+
* QTap sends the "abort" event when it finds that a test run has finished, or if it
Copy file name to clipboardexpand all lines: ARCHITECTURE.md
+7-11
Original file line number
Diff line number
Diff line change
@@ -47,13 +47,13 @@ Examples:
47
47
48
48
Performance is a first-class principle in QTap.
49
49
50
-
The first priority (after the "Simple" and "Lean" values above) is time to first result. This means the CLI endpoint should as directly as possible launch browsers and start the ControlServer. Any computation, imports and other overhead is deferred when possible.
50
+
The first priority (after the "Simple" and "Lean" values above) is time to first result. This means the CLI endpoint should as directly as possible start browsers and start the ControlServer. Any computation, imports and other overhead is deferred when possible.
51
51
52
52
The second piority is time to last result (e.g. "Done!"), which is generally what a human in local development (especially in watch mode) will be waiting for. Note that this is separate from when the CLI process technically exits, which is less important to us. It is expected that the process will in practice exit immediately after the last result is printed, but when we have a choice, it is important to first get and communicate test results. In particular for watch mode, shutdown logic will not happen on re-runs and thus is avoided if we don't do it in the critical path toward obtaining test results.
53
53
54
54
## Debugging
55
55
56
-
Set `QTAP_DEBUG=1` as environment variable, when calling the QTap CLI, to launch local browsers visibly instead of headless.
56
+
Set `QTAP_DEBUG=1` as environment variable, when calling the QTap CLI, to start local browsers visibly instead of headless.
57
57
58
58
Set `--verbose` in the QTap CLI to enable verbose debug logging.
59
59
@@ -122,11 +122,11 @@ Set `--verbose` in the QTap CLI to enable verbose debug logging.
122
122
123
123
***Page-side script injection**. The HTML file is modified to include an inline script that subscribes to `console.log` and other events, and beacons to our command-line process. More details at [QTap Internal: Client send](#qtap-internal-client-send).
124
124
125
-
This means browser can be launched by any means, pointed at a URL, and then forgotten about until we shut it down. It requires no control over the browser process. And the requirements for someone writing a browser launcher, is thus merely to open a single URL. More details at [QTap API: Browser launcher](#qtap-internal-client-send).
125
+
This means browser can be started by any means, pointed at a URL, and then forgotten about until we shut it down. It requires no control over the browser process. And the requirements for someone writing a browser launcher, is thus merely to open a single URL. More details at [QTap API: Browser launcher](#qtap-internal-client-send).
126
126
127
127
## QTap API: Browser launcher
128
128
129
-
Each browser is implemented as a single async function that launches the browser. The function is called with all required information and services. The [injected](https://en.wikipedia.org/wiki/Dependency_injection) parameters include a URL, an abort signal, and a logger function.
129
+
Each browser is implemented as a single async function that opens the browser. The function is called with all required information and services. The [injected](https://en.wikipedia.org/wiki/Dependency_injection) parameters include a URL, an abort signal, and a logger function.
130
130
131
131
The function is expected to run as long as the browser is running, with the returned Promise representing the browser process. If the browser exits for any reason, you may run any cleanup and then return. If the browser fails or crashes for any reason, this can be conveyed by throwing an error (or rejecting a Promise) from your async function.
0 commit comments