system-testing 1.0.78 → 1.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -6
- package/build/browser-command-client.d.ts +19 -0
- package/build/browser-command-client.js +39 -0
- package/build/browser-command-runner.d.ts +27 -0
- package/build/browser-command-runner.js +144 -0
- package/build/browser-process.d.ts +45 -0
- package/build/browser-process.js +127 -0
- package/build/browser-registry.d.ts +34 -0
- package/build/browser-registry.js +110 -0
- package/build/browser.d.ts +222 -0
- package/build/browser.js +358 -0
- package/build/cli-helpers.d.ts +16 -0
- package/build/cli-helpers.js +141 -0
- package/build/cli.d.ts +2 -0
- package/build/cli.js +72 -0
- package/build/drivers/webdriver-driver.d.ts +4 -4
- package/build/drivers/webdriver-driver.js +10 -9
- package/build/index.d.ts +9 -1
- package/build/index.js +10 -3
- package/build/system-test-browser-helper.d.ts +6 -12
- package/build/system-test-browser-helper.js +12 -13
- package/build/system-test.d.ts +3 -189
- package/build/system-test.js +6 -220
- package/build/use-system-test-expo.d.ts +16 -0
- package/build/use-system-test-expo.js +34 -0
- package/build/use-system-test-react-native.d.ts +25 -0
- package/build/use-system-test-react-native.js +20 -0
- package/build/use-system-test-shape-hook.d.ts +35 -0
- package/build/use-system-test-shape-hook.js +74 -0
- package/build/use-system-test.d.ts +19 -10
- package/build/use-system-test.js +26 -72
- package/package.json +9 -3
package/build/system-test.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* @typedef {object} NotificationMessageArgs
|
|
30
30
|
* @property {boolean} [dismiss] Whether to dismiss the notification after it appears.
|
|
31
31
|
*/
|
|
32
|
-
export default class SystemTest {
|
|
32
|
+
export default class SystemTest extends Browser {
|
|
33
33
|
static rootPath: string;
|
|
34
34
|
/**
|
|
35
35
|
* Gets the current system test instance
|
|
@@ -57,21 +57,11 @@ export default class SystemTest {
|
|
|
57
57
|
* @param {SystemTestArgs} [args]
|
|
58
58
|
*/
|
|
59
59
|
constructor({ host, port, httpHost, httpPort, httpConnectHost, debug, errorFilter, urlArgs, driver, ...restArgs }?: SystemTestArgs);
|
|
60
|
-
/** @type {SystemTestCommunicator | undefined} */
|
|
61
|
-
communicator: SystemTestCommunicator | undefined;
|
|
62
|
-
/** @type {import("selenium-webdriver").WebDriver | undefined} */
|
|
63
|
-
driver: import("selenium-webdriver").WebDriver | undefined;
|
|
64
|
-
/** @type {import("./drivers/webdriver-driver.js").default | undefined} */
|
|
65
|
-
driverAdapter: import("./drivers/webdriver-driver.js").default | undefined;
|
|
66
60
|
_started: boolean;
|
|
67
|
-
/** @type {SystemTestDriverConfig | undefined} */
|
|
68
|
-
_driverConfig: SystemTestDriverConfig | undefined;
|
|
69
61
|
_httpHost: string;
|
|
70
62
|
_httpPort: number;
|
|
71
63
|
/** @type {(error: any) => boolean | undefined} */
|
|
72
64
|
_errorFilter: (error: any) => boolean | undefined;
|
|
73
|
-
/** @type {Error | undefined} */
|
|
74
|
-
_httpServerError: Error | undefined;
|
|
75
65
|
/** @type {WebSocketServer | undefined} */
|
|
76
66
|
scoundrelWss: WebSocketServer | undefined;
|
|
77
67
|
/** @type {WebSocketServer | undefined} */
|
|
@@ -99,57 +89,11 @@ export default class SystemTest {
|
|
|
99
89
|
_host: string;
|
|
100
90
|
_port: number;
|
|
101
91
|
_httpConnectHost: string;
|
|
102
|
-
_debug: boolean;
|
|
103
92
|
_urlArgs: Record<string, any>;
|
|
104
93
|
_rootPath: string;
|
|
105
94
|
/** @type {Record<number, object>} */
|
|
106
95
|
_responses: Record<number, object>;
|
|
107
96
|
_sendCount: number;
|
|
108
|
-
/**
|
|
109
|
-
* Gets the base selector for scoping element searches
|
|
110
|
-
* @returns {string | undefined}
|
|
111
|
-
*/
|
|
112
|
-
getBaseSelector(): string | undefined;
|
|
113
|
-
/** @returns {import("selenium-webdriver").WebDriver} */
|
|
114
|
-
getDriver(): import("selenium-webdriver").WebDriver;
|
|
115
|
-
/** @returns {import("./drivers/webdriver-driver.js").default} */
|
|
116
|
-
getDriverAdapter(): import("./drivers/webdriver-driver.js").default;
|
|
117
|
-
/**
|
|
118
|
-
* @param {SystemTestDriverConfig} [driverConfig]
|
|
119
|
-
* @returns {import("./drivers/webdriver-driver.js").default}
|
|
120
|
-
*/
|
|
121
|
-
createDriver(driverConfig?: SystemTestDriverConfig): import("./drivers/webdriver-driver.js").default;
|
|
122
|
-
/**
|
|
123
|
-
* Sets the base selector for scoping element searches
|
|
124
|
-
* @param {string} baseSelector
|
|
125
|
-
*/
|
|
126
|
-
setBaseSelector(baseSelector: string): void;
|
|
127
|
-
_baseSelector: string;
|
|
128
|
-
/**
|
|
129
|
-
* Gets a selector scoped to the base selector
|
|
130
|
-
* @param {string} selector
|
|
131
|
-
* @returns {string}
|
|
132
|
-
*/
|
|
133
|
-
getSelector(selector: string): string;
|
|
134
|
-
/**
|
|
135
|
-
* Logs messages
|
|
136
|
-
* @param {any[]} args
|
|
137
|
-
* @returns {void}
|
|
138
|
-
*/
|
|
139
|
-
debugError(...args: any[]): void;
|
|
140
|
-
/**
|
|
141
|
-
* Logs messages when debugging is enabled
|
|
142
|
-
* @param {any[]} args
|
|
143
|
-
* @returns {void}
|
|
144
|
-
*/
|
|
145
|
-
debugLog(...args: any[]): void;
|
|
146
|
-
/** @returns {void} */
|
|
147
|
-
throwIfHttpServerError(): void;
|
|
148
|
-
/**
|
|
149
|
-
* @param {Error} error
|
|
150
|
-
* @returns {void}
|
|
151
|
-
*/
|
|
152
|
-
onHttpServerError: (error: Error) => void;
|
|
153
97
|
/**
|
|
154
98
|
* Starts Scoundrel server which the browser connects to for remote evaluation in the browser
|
|
155
99
|
* @returns {void}
|
|
@@ -167,79 +111,6 @@ export default class SystemTest {
|
|
|
167
111
|
* @returns {Promise<import("scoundrel-remote-eval/build/client/index.js").default>}
|
|
168
112
|
*/
|
|
169
113
|
getScoundrelClient(timeoutMs?: number): Promise<import("scoundrel-remote-eval/build/client/index.js").default>;
|
|
170
|
-
/**
|
|
171
|
-
* Finds all elements by CSS selector
|
|
172
|
-
* @param {string} selector
|
|
173
|
-
* @param {FindArgs} [args]
|
|
174
|
-
* @returns {Promise<import("selenium-webdriver").WebElement[]>}
|
|
175
|
-
*/
|
|
176
|
-
all(selector: string, args?: FindArgs): Promise<import("selenium-webdriver").WebElement[]>;
|
|
177
|
-
/**
|
|
178
|
-
* Clicks an element that has children which fills out the element and would otherwise have caused a ElementClickInterceptedError
|
|
179
|
-
* @param {string|import("selenium-webdriver").WebElement} elementOrIdentifier
|
|
180
|
-
* @returns {Promise<void>}
|
|
181
|
-
*/
|
|
182
|
-
/**
|
|
183
|
-
* Clicks an element, allowing selector args when using a CSS selector.
|
|
184
|
-
* @param {string|import("selenium-webdriver").WebElement} elementOrIdentifier
|
|
185
|
-
* @param {FindArgs} [args]
|
|
186
|
-
* @returns {Promise<void>}
|
|
187
|
-
*/
|
|
188
|
-
click(elementOrIdentifier: string | import("selenium-webdriver").WebElement, args?: FindArgs): Promise<void>;
|
|
189
|
-
/**
|
|
190
|
-
* Finds a single element by CSS selector
|
|
191
|
-
* @param {string} selector
|
|
192
|
-
* @param {FindArgs} [args]
|
|
193
|
-
* @returns {Promise<import("selenium-webdriver").WebElement>}
|
|
194
|
-
*/
|
|
195
|
-
find(selector: string, args?: FindArgs): Promise<import("selenium-webdriver").WebElement>;
|
|
196
|
-
/**
|
|
197
|
-
* Finds a single element by test ID
|
|
198
|
-
* @param {string} testID
|
|
199
|
-
* @param {FindArgs} [args]
|
|
200
|
-
* @returns {Promise<import("selenium-webdriver").WebElement>}
|
|
201
|
-
*/
|
|
202
|
-
findByTestID(testID: string, args?: FindArgs): Promise<import("selenium-webdriver").WebElement>;
|
|
203
|
-
/**
|
|
204
|
-
* Finds a single element by CSS selector without waiting
|
|
205
|
-
* @param {string} selector
|
|
206
|
-
* @param {FindArgs} [args]
|
|
207
|
-
* @returns {Promise<import("selenium-webdriver").WebElement>}
|
|
208
|
-
*/
|
|
209
|
-
findNoWait(selector: string, args?: FindArgs): Promise<import("selenium-webdriver").WebElement>;
|
|
210
|
-
/**
|
|
211
|
-
* Gets browser logs
|
|
212
|
-
* @returns {Promise<string[]>}
|
|
213
|
-
*/
|
|
214
|
-
getBrowserLogs(): Promise<string[]>;
|
|
215
|
-
/** @returns {Promise<string>} */
|
|
216
|
-
getCurrentUrl(): Promise<string>;
|
|
217
|
-
/** @returns {number} */
|
|
218
|
-
getTimeouts(): number;
|
|
219
|
-
/**
|
|
220
|
-
* Interacts with an element by calling a method on it with the given arguments.
|
|
221
|
-
* Retrying on ElementNotInteractableError, ElementClickInterceptedError, or StaleElementReferenceError.
|
|
222
|
-
* @param {import("selenium-webdriver").WebElement|string|{selector: string} & FindArgs} elementOrIdentifier The element or a CSS selector to find the element.
|
|
223
|
-
* @param {string} methodName The method name to call on the element.
|
|
224
|
-
* @param {...any} args Arguments to pass to the method.
|
|
225
|
-
* @returns {Promise<any>}
|
|
226
|
-
*/
|
|
227
|
-
interact(elementOrIdentifier: import("selenium-webdriver").WebElement | string | ({
|
|
228
|
-
selector: string;
|
|
229
|
-
} & FindArgs), methodName: string, ...args: any[]): Promise<any>;
|
|
230
|
-
/**
|
|
231
|
-
* Expects no element to be found by CSS selector
|
|
232
|
-
* @param {string} selector
|
|
233
|
-
* @param {FindArgs} [args]
|
|
234
|
-
* @returns {Promise<void>}
|
|
235
|
-
*/
|
|
236
|
-
expectNoElement(selector: string, args?: FindArgs): Promise<void>;
|
|
237
|
-
/**
|
|
238
|
-
* @param {string} selector
|
|
239
|
-
* @param {WaitForNoSelectorArgs} [args]
|
|
240
|
-
* @returns {Promise<void>}
|
|
241
|
-
*/
|
|
242
|
-
waitForNoSelector(selector: string, args?: WaitForNoSelectorArgs): Promise<void>;
|
|
243
114
|
/**
|
|
244
115
|
* Gets notification messages
|
|
245
116
|
* @returns {Promise<string[]>}
|
|
@@ -259,11 +130,6 @@ export default class SystemTest {
|
|
|
259
130
|
* @returns {boolean}
|
|
260
131
|
*/
|
|
261
132
|
isStarted(): boolean;
|
|
262
|
-
/**
|
|
263
|
-
* Gets the HTML of the current page
|
|
264
|
-
* @returns {Promise<string>}
|
|
265
|
-
*/
|
|
266
|
-
getHTML(): Promise<string>;
|
|
267
133
|
/**
|
|
268
134
|
* Starts the system test
|
|
269
135
|
* @returns {Promise<void>}
|
|
@@ -279,23 +145,6 @@ export default class SystemTest {
|
|
|
279
145
|
* @returns {string}
|
|
280
146
|
*/
|
|
281
147
|
buildRootPath(): string;
|
|
282
|
-
/**
|
|
283
|
-
* Restores previously set timeouts
|
|
284
|
-
* @returns {Promise<void>}
|
|
285
|
-
*/
|
|
286
|
-
restoreTimeouts(): Promise<void>;
|
|
287
|
-
/**
|
|
288
|
-
* Sets driver timeouts
|
|
289
|
-
* @param {number} newTimeout
|
|
290
|
-
* @returns {Promise<void>}
|
|
291
|
-
*/
|
|
292
|
-
driverSetTimeouts(newTimeout: number): Promise<void>;
|
|
293
|
-
/**
|
|
294
|
-
* Sets timeouts and stores the previous timeouts
|
|
295
|
-
* @param {number} newTimeout
|
|
296
|
-
* @returns {Promise<void>}
|
|
297
|
-
*/
|
|
298
|
-
setTimeouts(newTimeout: number): Promise<void>;
|
|
299
148
|
/**
|
|
300
149
|
* Waits for the client web socket to connect
|
|
301
150
|
* @returns {Promise<void>}
|
|
@@ -364,42 +213,6 @@ export default class SystemTest {
|
|
|
364
213
|
* @returns {Promise<void>}
|
|
365
214
|
*/
|
|
366
215
|
reinitialize(): Promise<void>;
|
|
367
|
-
/**
|
|
368
|
-
* Visits a path in the browser
|
|
369
|
-
* @param {string} path
|
|
370
|
-
* @returns {Promise<void>}
|
|
371
|
-
*/
|
|
372
|
-
driverVisit(path: string): Promise<void>;
|
|
373
|
-
/**
|
|
374
|
-
* Formats browser logs for console output and truncates overly long output.
|
|
375
|
-
* @param {string[]} logs
|
|
376
|
-
* @param {number} [maxLines]
|
|
377
|
-
* @returns {string[]}
|
|
378
|
-
*/
|
|
379
|
-
formatBrowserLogsForConsole(logs: string[], maxLines?: number): string[];
|
|
380
|
-
/**
|
|
381
|
-
* Prints browser logs to stdout for CI visibility when tests fail.
|
|
382
|
-
* @param {string[]} logs
|
|
383
|
-
* @returns {void}
|
|
384
|
-
*/
|
|
385
|
-
printBrowserLogsForFailure(logs: string[]): void;
|
|
386
|
-
/**
|
|
387
|
-
* Takes a screenshot, saves HTML and browser logs
|
|
388
|
-
* @returns {Promise<void>}
|
|
389
|
-
*/
|
|
390
|
-
takeScreenshot(): Promise<void>;
|
|
391
|
-
/**
|
|
392
|
-
* Visits a path in the browser
|
|
393
|
-
* @param {string} path
|
|
394
|
-
* @returns {Promise<void>}
|
|
395
|
-
*/
|
|
396
|
-
visit(path: string): Promise<void>;
|
|
397
|
-
/**
|
|
398
|
-
* Dismisses to a path in the browser
|
|
399
|
-
* @param {string} path
|
|
400
|
-
* @returns {Promise<void>}
|
|
401
|
-
*/
|
|
402
|
-
dismissTo(path: string): Promise<void>;
|
|
403
216
|
/**
|
|
404
217
|
* @param {WebSocketServer | undefined} wss
|
|
405
218
|
* @param {string} [label]
|
|
@@ -481,8 +294,9 @@ export type NotificationMessageArgs = {
|
|
|
481
294
|
*/
|
|
482
295
|
dismiss?: boolean;
|
|
483
296
|
};
|
|
484
|
-
import
|
|
297
|
+
import Browser from "./browser.js";
|
|
485
298
|
import { WebSocketServer } from "ws";
|
|
299
|
+
import SystemTestCommunicator from "./system-test-communicator.js";
|
|
486
300
|
import ServerWebSocket from "scoundrel-remote-eval/build/server/connections/web-socket/index.js";
|
|
487
301
|
import Server from "scoundrel-remote-eval/build/server/index.js";
|
|
488
302
|
import SystemTestHttpServer from "./system-test-http-server.js";
|