@unotest/web 0.49.1 → 0.50.0

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.
@@ -10,7 +10,7 @@ interface Locator {
10
10
  *
11
11
  * Keep matches by contained text or a nested child locator.
12
12
  */
13
- filter(options: any): Locator;
13
+ filter(options: { [key: string]: unknown }): Locator;
14
14
  /**
15
15
  * first(locator)
16
16
  *
@@ -36,47 +36,47 @@ interface Locator {
36
36
  */
37
37
  randomNth(): Locator;
38
38
  /**
39
- * locator(css)
39
+ * locator(css, { hasText?, hasNotText?, has?, hasNot? }?)
40
40
  *
41
- * Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS.
41
+ * Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS. Options narrow the matches exactly as filter() does.
42
42
  */
43
- locator(selector: string): Locator;
43
+ locator(selector: string, options?: { [key: string]: unknown }): Locator;
44
44
  /**
45
- * getByRole(role, { name?, exact? })
45
+ * getByRole(role, { name?, exact?, checked?, disabled?, expanded?, includeHidden?, level?, pressed?, selected? })
46
46
  *
47
- * Match by ARIA role + accessible name. `name` accepts a string or `/regex/`.
47
+ * Match by ARIA role + accessible name. `name` accepts a string or `/regex/`; the state options narrow by ARIA state (`{disabled: false}` skips a disabled button). Any other key is refused.
48
48
  */
49
- getByRole(role: string, options?: any): Locator;
49
+ getByRole(role: string, options?: { [key: string]: unknown }): Locator;
50
50
  /**
51
51
  * getByText(text, { exact? })
52
52
  *
53
53
  * Match by visible text content.
54
54
  */
55
- getByText(text: string | RegExp, options?: any): Locator;
55
+ getByText(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
56
56
  /**
57
57
  * getByLabel(text, { exact? })
58
58
  *
59
59
  * Match a form control by its associated label.
60
60
  */
61
- getByLabel(text: string | RegExp, options?: any): Locator;
61
+ getByLabel(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
62
62
  /**
63
63
  * getByPlaceholder(text, { exact? })
64
64
  *
65
65
  * Match an input by its placeholder.
66
66
  */
67
- getByPlaceholder(text: string | RegExp, options?: any): Locator;
67
+ getByPlaceholder(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
68
68
  /**
69
69
  * getByAltText(text, { exact? })
70
70
  *
71
71
  * Match an image by its `alt` text.
72
72
  */
73
- getByAltText(text: string | RegExp, options?: any): Locator;
73
+ getByAltText(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
74
74
  /**
75
75
  * getByTitle(text, { exact? })
76
76
  *
77
77
  * Match by `title` attribute.
78
78
  */
79
- getByTitle(text: string | RegExp, options?: any): Locator;
79
+ getByTitle(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
80
80
  /**
81
81
  * getByTestId(id)
82
82
  *
@@ -96,70 +96,70 @@ interface Locator {
96
96
  *
97
97
  * Click an element.
98
98
  */
99
- declare function click(locator: Locator, options?: any): void;
99
+ declare function click(locator: Locator, options?: { [key: string]: unknown }): void;
100
100
 
101
101
  /**
102
102
  * doubleClick(locator, { force?, timeout? })
103
103
  *
104
104
  * Double-click an element.
105
105
  */
106
- declare function doubleClick(locator: Locator, options?: any): void;
106
+ declare function doubleClick(locator: Locator, options?: { [key: string]: unknown }): void;
107
107
 
108
108
  /**
109
109
  * check(locator, { force?, timeout? })
110
110
  *
111
- * Check a checkbox/radio.
111
+ * Check a checkbox/radio/switch: click, then wait until it reads checked (a controlled widget may flip a beat later). Already checked → no click.
112
112
  */
113
- declare function check(locator: Locator, options?: any): void;
113
+ declare function check(locator: Locator, options?: { [key: string]: unknown }): void;
114
114
 
115
115
  /**
116
116
  * uncheck(locator, { force?, timeout? })
117
117
  *
118
- * Uncheck a checkbox.
118
+ * Uncheck a checkbox/switch: click, then wait until it reads unchecked. Already unchecked → no click.
119
119
  */
120
- declare function uncheck(locator: Locator, options?: any): void;
120
+ declare function uncheck(locator: Locator, options?: { [key: string]: unknown }): void;
121
121
 
122
122
  /**
123
123
  * hover(locator, { force?, position?, timeout? })
124
124
  *
125
125
  * Hover over an element. `position` is an {x, y} offset inside it — for a menu that only appears at one edge of a tall element.
126
126
  */
127
- declare function hover(locator: Locator, options?: any): void;
127
+ declare function hover(locator: Locator, options?: { [key: string]: unknown }): void;
128
128
 
129
129
  /**
130
130
  * scrollIntoView(locator)
131
131
  *
132
132
  * Scroll an element into the viewport.
133
133
  */
134
- declare function scrollIntoView(locator: Locator, options?: any): void;
134
+ declare function scrollIntoView(locator: Locator): void;
135
135
 
136
136
  /**
137
137
  * fill(locator, value, { force?, timeout? })
138
138
  *
139
139
  * Clear and type a value into an input.
140
140
  */
141
- declare function fill(locator: Locator, text: string, options?: any): void;
141
+ declare function fill(locator: Locator, text: string, options?: { [key: string]: unknown }): void;
142
142
 
143
143
  /**
144
144
  * press(locator, key, { delay?, timeout? })
145
145
  *
146
146
  * Press a key (e.g. 'Enter', 'Control+A').
147
147
  */
148
- declare function press(locator: Locator, key: string, options?: any): void;
148
+ declare function press(locator: Locator, key: string, options?: { [key: string]: unknown }): void;
149
149
 
150
150
  /**
151
151
  * selectOption(locator, value, { timeout? })
152
152
  *
153
153
  * Select option(s) in a `<select>`. `value` is a string or string[].
154
154
  */
155
- declare function selectOption(locator: Locator, value: any): void;
155
+ declare function selectOption(locator: Locator, value: any, options?: { [key: string]: unknown }): void;
156
156
 
157
157
  /**
158
158
  * dragAndDrop(from, to, { force?, timeout? })
159
159
  *
160
160
  * Drag one element onto another. Uses synthetic mouse events (not native HTML5 DragEvent).
161
161
  */
162
- declare function dragAndDrop(source: Locator, target: Locator): void;
162
+ declare function dragAndDrop(source: Locator, target: Locator, options?: { [key: string]: unknown }): void;
163
163
 
164
164
  /**
165
165
  * uploadFile(locator, files)
@@ -180,63 +180,63 @@ declare function clipboardPaste(target: Locator, text: string): void;
180
180
  *
181
181
  * Element's text equals `expected` (a string; exact: false — contains it) or matches it (a /regex/). {not: true} waits until it no longer does. Empty: assertText(loc, ''); not empty: assertText(loc, '', {not: true}).
182
182
  */
183
- declare function assertText(locator: Locator, text: string | RegExp, options?: any): void;
183
+ declare function assertText(locator: Locator, text: string | RegExp, options?: { [key: string]: unknown }): void;
184
184
 
185
185
  /**
186
186
  * assertTexts(locator, expected, { exact?, timeout? })
187
187
  *
188
188
  * The locator matches exactly expected.length elements, and element i's text matches expected[i] (string or /regex/, same rules as assertText), in order.
189
189
  */
190
- declare function assertTexts(locator: Locator, expected: unknown[], options?: any): void;
190
+ declare function assertTexts(locator: Locator, expected: unknown[], options?: { [key: string]: unknown }): void;
191
191
 
192
192
  /**
193
193
  * assertAttribute(locator, name, expected, { exact?, not?, timeout? })
194
194
  *
195
195
  * Polls the attribute `name` until it equals `expected` (exact: false — contains) or matches a /regex/. An absent attribute matches nothing. {not: true} waits until it no longer matches or is gone.
196
196
  */
197
- declare function assertAttribute(locator: Locator, name: string, value: string | RegExp, options?: any): void;
197
+ declare function assertAttribute(locator: Locator, name: string, value: string | RegExp, options?: { [key: string]: unknown }): void;
198
198
 
199
199
  /**
200
200
  * assertVisible(locator, { timeout? })
201
201
  *
202
202
  * Element is visible.
203
203
  */
204
- declare function assertVisible(locator: Locator, options?: any): void;
204
+ declare function assertVisible(locator: Locator, options?: { [key: string]: unknown }): void;
205
205
 
206
206
  /**
207
207
  * assertHidden(locator, { timeout? })
208
208
  *
209
209
  * Element is hidden or detached.
210
210
  */
211
- declare function assertHidden(locator: Locator, options?: any): void;
211
+ declare function assertHidden(locator: Locator, options?: { [key: string]: unknown }): void;
212
212
 
213
213
  /**
214
214
  * assertNeverAppears(locator, { withinMs })
215
215
  *
216
216
  * Negative window assert: FAIL the moment the locator becomes visible; pass when the whole window elapsed clean. withinMs required; the step always costs that long.
217
217
  */
218
- declare function assertNeverAppears(locator: Locator, options: any): void;
218
+ declare function assertNeverAppears(locator: Locator, options: { [key: string]: unknown }): void;
219
219
 
220
220
  /**
221
221
  * assertValue(locator, expected, { timeout? })
222
222
  *
223
223
  * Input's value equals `expected`. On a checkbox/radio/switch: its checked state — pass 'true' or 'false'.
224
224
  */
225
- declare function assertValue(locator: Locator, value: string, options?: any): void;
225
+ declare function assertValue(locator: Locator, value: string, options?: { [key: string]: unknown }): void;
226
226
 
227
227
  /**
228
228
  * assertCount(locator, expected, { timeout? })
229
229
  *
230
230
  * Number of matches equals `expected`.
231
231
  */
232
- declare function assertCount(locator: Locator, count: number, options?: any): void;
232
+ declare function assertCount(locator: Locator, count: number, options?: { [key: string]: unknown }): void;
233
233
 
234
234
  /**
235
235
  * assertUrl(pattern, { timeout? })
236
236
  *
237
237
  * Current URL contains `pattern` (a string) or matches it (a /regex/, unanchored). A failure names the pattern as /source/flags.
238
238
  */
239
- declare function assertUrl(pattern: string | RegExp, options?: any): void;
239
+ declare function assertUrl(pattern: string | RegExp, options?: { [key: string]: unknown }): void;
240
240
 
241
241
  /**
242
242
  * assertJudge(locator, rubric)
@@ -250,7 +250,7 @@ declare function assertJudge(locator: Locator, rubric: string): void;
250
250
  *
251
251
  * The page (or an element) against the PNG baseline unotest/e2e/<scenario>.screenshots/<name>.png. A pixel differs when any channel differs by more than threshold (default 32); fails when the share of differing pixels is MORE than maxDiffRatio (default 0). mask: locators, ignore: rectangles in baseline pixels — both left out of the comparison. No baseline: fails and saves the snapshot as a candidate; accept with e2e --update-screenshots. On failure the run keeps expected / actual / diff.
252
252
  */
253
- declare function assertScreenshot(nameOrLocator: any, nameOrOptions?: any, options?: any): void;
253
+ declare function assertScreenshot(nameOrLocator: any, nameOrOptions?: any, options?: { [key: string]: unknown }): void;
254
254
 
255
255
  /**
256
256
  * assertEqual(actual, expected)
@@ -292,7 +292,7 @@ declare function setTestTimeout(ms: number): void;
292
292
  *
293
293
  * Keep matches by contained text or a nested child locator.
294
294
  */
295
- declare function filter(receiver: Locator, options: any): Locator;
295
+ declare function filter(receiver: Locator, options: { [key: string]: unknown }): Locator;
296
296
 
297
297
  /**
298
298
  * first(locator)
@@ -327,7 +327,7 @@ declare function randomNth(receiver: Locator): Locator;
327
327
  *
328
328
  * Capture the active page into the run's artifact dir; returns the project-relative path. For a PNG after EVERY step without calling it, set UNOTEST_STEP_SCREENSHOTS=1 in the run's environment.
329
329
  */
330
- declare function screenshot(name?: string, options?: any): string;
330
+ declare function screenshot(name?: string, options?: { [key: string]: unknown }): string;
331
331
 
332
332
  /**
333
333
  * note(label, value)
@@ -341,49 +341,49 @@ declare function note(label: string, value: any): void;
341
341
  *
342
342
  * What the active page wrote to its console, oldest first: `level` is log, info, warn, error or debug. Recorded from the moment the page opened, so act first, then ask. Extension pages (chrome-extension://) too. options: {level} (one level or a list), {since} (epoch ms, from nowMs()).
343
343
  */
344
- declare function consoleEntries(options?: any): any;
344
+ declare function consoleEntries(options?: { [key: string]: unknown }): any;
345
345
 
346
346
  /**
347
347
  * pageErrors({ since? }) → [{ message, stack }]
348
348
  *
349
349
  * Errors the active page threw and nothing caught (an uncaught exception, a rejected promise), oldest first; `stack` is empty when the browser gave none. options: {since} (epoch ms, from nowMs()).
350
350
  */
351
- declare function pageErrors(options?: any): any;
351
+ declare function pageErrors(options?: { [key: string]: unknown }): any;
352
352
 
353
353
  /**
354
354
  * assertNoConsoleErrors({ includePageErrors?, since? })
355
355
  *
356
356
  * FAIL when the active page logged console errors, or threw uncaught ones (unless {includePageErrors: false}), quoting the first three. With `since` (epoch ms, from nowMs()) only from then on.
357
357
  */
358
- declare function assertNoConsoleErrors(options?: any): void;
358
+ declare function assertNoConsoleErrors(options?: { [key: string]: unknown }): void;
359
359
 
360
360
  /**
361
361
  * evaluate(js, arg?) → any
362
362
  *
363
363
  * Run raw JS in the page context. Last resort — prefer typed helpers. Returns JSON-serializable values only. Extra arguments reach the body as: none → nothing, exactly one → the value itself, two or more → ONE array (destructure `([a, b]) => …`).
364
364
  */
365
- declare function evaluate(jsBody: string, ...args: unknown[]): any;
365
+ declare function evaluate(jsBody: any, ...args: unknown[]): any;
366
366
 
367
367
  /**
368
368
  * evaluateOnLocator(locator, js, ...args) → any
369
369
  *
370
370
  * Like evaluate, on the matched element: the body is called with the element, then the extra arguments by the same rule (`(el, x) => …`, two or more → `(el, [a, b]) => …`). Last resort — prefer typed getters.
371
371
  */
372
- declare function evaluateOnLocator(locator: Locator, jsBody: string, ...args: unknown[]): any;
372
+ declare function evaluateOnLocator(locator: Locator, jsBody: any, ...args: unknown[]): any;
373
373
 
374
374
  /**
375
375
  * setPage(index, options?)
376
376
  *
377
377
  * Switch the active tab/page by index (0-based) and bring it to front. {activate: false} switches only the tab the steps act on and leaves the visible tab as is.
378
378
  */
379
- declare function setPage(indexOrTitle: string | number, options?: any): void;
379
+ declare function setPage(indexOrTitle: string | number, options?: { [key: string]: unknown }): void;
380
380
 
381
381
  /**
382
382
  * waitForPage(options?) → number
383
383
  *
384
384
  * Wait for a tab the scenario has not been handed yet (window.open, target=_blank, an extension), switch to it and return its index. Counts a tab that opened before the call. {timeoutMs} defaults to the navigation timeout.
385
385
  */
386
- declare function waitForPage(options?: any): number;
386
+ declare function waitForPage(options?: { [key: string]: unknown }): number;
387
387
 
388
388
  /**
389
389
  * bringToFront(index?)
@@ -453,42 +453,42 @@ declare function exitFrame(): void;
453
453
  *
454
454
  * Navigate to a URL. `waitUntil`: 'load' | 'domcontentloaded' | 'networkidle'. Relative paths resolve against `baseUrl`.
455
455
  */
456
- declare function goto(url: string, options?: any): void;
456
+ declare function goto(url: string, options?: { [key: string]: unknown }): void;
457
457
 
458
458
  /**
459
459
  * reload({ waitUntil?, timeout? })
460
460
  *
461
461
  * Reload the current page.
462
462
  */
463
- declare function reload(options?: any): void;
463
+ declare function reload(options?: { [key: string]: unknown }): void;
464
464
 
465
465
  /**
466
466
  * goBack({ timeout? })
467
467
  *
468
468
  * Navigate back in history.
469
469
  */
470
- declare function goBack(): void;
470
+ declare function goBack(options?: { [key: string]: unknown }): void;
471
471
 
472
472
  /**
473
473
  * goForward({ timeout? })
474
474
  *
475
475
  * Navigate forward in history.
476
476
  */
477
- declare function goForward(): void;
477
+ declare function goForward(options?: { [key: string]: unknown }): void;
478
478
 
479
479
  /**
480
480
  * waitForUrl(pattern, { timeout? })
481
481
  *
482
482
  * Wait until the URL contains `pattern` (a string, substring match) or matches it (a /regex/, unanchored).
483
483
  */
484
- declare function waitForUrl(pattern: string | RegExp, options?: any): void;
484
+ declare function waitForUrl(pattern: string | RegExp, options?: { [key: string]: unknown }): void;
485
485
 
486
486
  /**
487
487
  * waitForNavigation({ timeout? })
488
488
  *
489
489
  * Wait for the next navigation event.
490
490
  */
491
- declare function waitForNavigation(options?: any): void;
491
+ declare function waitForNavigation(options?: { [key: string]: unknown }): void;
492
492
 
493
493
  /**
494
494
  * count(locator) → number
@@ -504,6 +504,13 @@ declare function count(locator: Locator): number;
504
504
  */
505
505
  declare function textContent(locator: Locator): string;
506
506
 
507
+ /**
508
+ * texts(locator) → string[]
509
+ *
510
+ * textContent of every match, in DOM order; [] when nothing matches. No wait — the list to branch on; assertTexts is the waiting check.
511
+ */
512
+ declare function texts(locator: Locator): any;
513
+
507
514
  /**
508
515
  * inputValue(locator) → string
509
516
  *
@@ -518,6 +525,13 @@ declare function inputValue(locator: Locator): string;
518
525
  */
519
526
  declare function isVisible(locator: Locator): boolean;
520
527
 
528
+ /**
529
+ * isChecked(locator) → boolean
530
+ *
531
+ * Checked state of a checkbox/radio/switch (native or ARIA role). Fails on any other element instead of answering false.
532
+ */
533
+ declare function isChecked(locator: Locator): boolean;
534
+
521
535
  /**
522
536
  * isDisabled(locator) → boolean
523
537
  *
@@ -663,7 +677,7 @@ declare function urlParam(url: string, key: string): any;
663
677
  *
664
678
  * A number as a page writes it: '1 234,5', '1,234.56', '−12'. Spaces (NBSP too) group digits; with both ',' and '.' the last one is the decimal mark; one mark used twice groups. '1,234' and '1.234' read both ways and FAIL unless {decimal: ',' | '.'} says which. Units and currency ('440px', '€12') FAIL, quoting the input — cut the number out with textMatches first. A number passes through.
665
679
  */
666
- declare function toNumber(text: any, options?: any): number;
680
+ declare function toNumber(text: any, options?: { [key: string]: unknown }): number;
667
681
 
668
682
  /**
669
683
  * round(n, digits?) → number
@@ -677,14 +691,14 @@ declare function round(n: number, digits?: number): number;
677
691
  *
678
692
  * A number as text, via Intl.NumberFormat with digit grouping. Without a locale it is en-US on every machine: formatNumber(1234.5) → '1,234.5'. Another locale's output (its spaces and marks) comes from the ICU of the Node that runs it.
679
693
  */
680
- declare function formatNumber(n: number, options?: any): string;
694
+ declare function formatNumber(n: number, options?: { [key: string]: unknown }): string;
681
695
 
682
696
  /**
683
- * env(name) → string | null
697
+ * env(name, fallback?) → string | fallback | null
684
698
  *
685
- * An environment value the test can do without: the ambient environment, unotest/.env or .secrets, as a bare UPPER_SNAKE name reads it — but null when unset instead of failing. For deciding on it: if (env('LIVE_API') == null) { … }. A secret is refused; write its bare name where the value is typed.
699
+ * An environment value the test can do without: the ambient environment, unotest/.env or .secrets, as a bare UPPER_SNAKE name reads it — but the fallback (null without one) when unset instead of failing. A default in one line: env('API_URL', 'http://localhost:3000'). For deciding on it: if (env('LIVE_API') == null) { … }. A secret is refused, fallback or not; write its bare name where the value is typed.
686
700
  */
687
- declare function env(name: string): any;
701
+ declare function env(name: string, fallback?: any): any;
688
702
 
689
703
  /**
690
704
  * shell(cmd, ...args, options?) → { stdout, stderr, code }
@@ -698,28 +712,28 @@ declare function shell(cmd: string, ...args: unknown[]): any;
698
712
  *
699
713
  * Poll a file (relative to config `shellCwd`) until it exists / contains a substring or regex, then return its content. options: {timeoutMs} (default 20s). The waitForText of background processes.
700
714
  */
701
- declare function waitForFile(path: string, pattern?: any, options?: any): string;
715
+ declare function waitForFile(path: string, pattern?: any, options?: { [key: string]: unknown }): string;
702
716
 
703
717
  /**
704
718
  * assertNoFile(path, pattern?, { withinMs })
705
719
  *
706
720
  * Mirror of waitForFile with inverted polarity: FAIL the moment the file exists (and matches pattern); pass when the window elapsed clean. withinMs required.
707
721
  */
708
- declare function assertNoFile(path: string, pattern?: any, options?: any): void;
722
+ declare function assertNoFile(path: string, pattern?: any, options?: { [key: string]: unknown }): void;
709
723
 
710
724
  /**
711
725
  * waitForJsonLine(path, filter, options?) → object
712
726
  *
713
727
  * Wait for a LINE of a JSONL file that matches every key of `filter` (strict equality, dot paths for nesting), then return it parsed. What a substring cannot express: JSON key order is not guaranteed. options: {timeoutMs} (default 20s).
714
728
  */
715
- declare function waitForJsonLine(path: string, filter: any, options?: any): any;
729
+ declare function waitForJsonLine(path: string, filter: any, options?: { [key: string]: unknown }): any;
716
730
 
717
731
  /**
718
732
  * assertNoJsonLine(path, filter, { withinMs })
719
733
  *
720
734
  * Negative twin of waitForJsonLine: FAIL the moment a matching line appears; pass when the window elapsed clean. withinMs required.
721
735
  */
722
- declare function assertNoJsonLine(path: string, filter: any, options?: any): void;
736
+ declare function assertNoJsonLine(path: string, filter: any, options?: { [key: string]: unknown }): void;
723
737
 
724
738
  /**
725
739
  * readJsonLine(path, filter) → object
@@ -740,7 +754,7 @@ declare function readJson(path: string): any;
740
754
  *
741
755
  * A whole file, read once: its text, or its bytes as base64 with {encoding: 'base64'}. Path is relative to config `shellCwd`, or absolute inside the project or to a file waitForDownload saved (its .path). FAILS at once when the path or a symlink leads out, the file is missing or the encoding is unknown.
742
756
  */
743
- declare function readFile(path: string, options?: any): string;
757
+ declare function readFile(path: string, options?: { [key: string]: unknown }): string;
744
758
 
745
759
  /**
746
760
  * readFileInfo(path) → object
@@ -754,7 +768,7 @@ declare function readFileInfo(path: string): any;
754
768
  *
755
769
  * Wait until AT LEAST `count` lines match, then return how many there are. `pattern` is a substring, a regex or a JSON key filter. options: {timeoutMs} (default 20s).
756
770
  */
757
- declare function waitForFileCount(path: string, pattern: any, count: number, options?: any): number;
771
+ declare function waitForFileCount(path: string, pattern: any, count: number, options?: { [key: string]: unknown }): number;
758
772
 
759
773
  /**
760
774
  * assertFileCount(path, pattern, count)
@@ -782,63 +796,63 @@ declare function dbExec(sql: string, ...args: unknown[]): number;
782
796
  *
783
797
  * HTTP call. `path` is relative — base is the config `apiBaseUrl`. Multipart: pass upload(...) as the body.
784
798
  */
785
- declare function apiCall(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS", path: string, body?: any, headers?: any, options?: any): any;
799
+ declare function apiCall(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS", path: string, body?: any, headers?: any, options?: { [key: string]: unknown }): any;
786
800
 
787
801
  /**
788
802
  * upload(path, options?) → UploadRef
789
803
  *
790
804
  * Multipart marker for apiCall's body (options: field, fields). Path is relative to the project root / config `uploadDir`.
791
805
  */
792
- declare function upload(path: string, options?: any): any;
806
+ declare function upload(path: string, options?: { [key: string]: unknown }): any;
793
807
 
794
808
  /**
795
- * locator(css)
809
+ * locator(css, { hasText?, hasNotText?, has?, hasNot? }?)
796
810
  *
797
- * Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS.
811
+ * Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS. Options narrow the matches exactly as filter() does.
798
812
  */
799
- declare function locator(selector: string): Locator;
813
+ declare function locator(selector: string, options?: { [key: string]: unknown }): Locator;
800
814
 
801
815
  /**
802
- * getByRole(role, { name?, exact? })
816
+ * getByRole(role, { name?, exact?, checked?, disabled?, expanded?, includeHidden?, level?, pressed?, selected? })
803
817
  *
804
- * Match by ARIA role + accessible name. `name` accepts a string or `/regex/`.
818
+ * Match by ARIA role + accessible name. `name` accepts a string or `/regex/`; the state options narrow by ARIA state (`{disabled: false}` skips a disabled button). Any other key is refused.
805
819
  */
806
- declare function getByRole(role: string, options?: any): Locator;
820
+ declare function getByRole(role: string, options?: { [key: string]: unknown }): Locator;
807
821
 
808
822
  /**
809
823
  * getByText(text, { exact? })
810
824
  *
811
825
  * Match by visible text content.
812
826
  */
813
- declare function getByText(text: string | RegExp, options?: any): Locator;
827
+ declare function getByText(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
814
828
 
815
829
  /**
816
830
  * getByLabel(text, { exact? })
817
831
  *
818
832
  * Match a form control by its associated label.
819
833
  */
820
- declare function getByLabel(text: string | RegExp, options?: any): Locator;
834
+ declare function getByLabel(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
821
835
 
822
836
  /**
823
837
  * getByPlaceholder(text, { exact? })
824
838
  *
825
839
  * Match an input by its placeholder.
826
840
  */
827
- declare function getByPlaceholder(text: string | RegExp, options?: any): Locator;
841
+ declare function getByPlaceholder(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
828
842
 
829
843
  /**
830
844
  * getByAltText(text, { exact? })
831
845
  *
832
846
  * Match an image by its `alt` text.
833
847
  */
834
- declare function getByAltText(text: string | RegExp, options?: any): Locator;
848
+ declare function getByAltText(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
835
849
 
836
850
  /**
837
851
  * getByTitle(text, { exact? })
838
852
  *
839
853
  * Match by `title` attribute.
840
854
  */
841
- declare function getByTitle(text: string | RegExp, options?: any): Locator;
855
+ declare function getByTitle(text: string | RegExp, options?: { [key: string]: unknown }): Locator;
842
856
 
843
857
  /**
844
858
  * getByTestId(id)
@@ -922,7 +936,7 @@ declare function getLocalStorage(key: string): string;
922
936
  *
923
937
  * Set a cookie (options: path, domain, expires, httpOnly, secure, sameSite).
924
938
  */
925
- declare function setCookie(name: string, value: string, options?: any): void;
939
+ declare function setCookie(name: string, value: string, options?: { [key: string]: unknown }): void;
926
940
 
927
941
  /**
928
942
  * getCookie(name) → string
@@ -936,28 +950,28 @@ declare function getCookie(name: string): string;
936
950
  *
937
951
  * Wait for an element state: DOM presence ('visible' default, 'hidden', 'attached', 'detached') or interaction ('enabled' / 'disabled' — same probe as isEnabled, so aria-disabled counts).
938
952
  */
939
- declare function waitFor(locator: Locator, options?: any): void;
953
+ declare function waitFor(locator: Locator, options?: { [key: string]: unknown }): void;
940
954
 
941
955
  /**
942
956
  * waitForText(text, { first?, timeout? })
943
957
  *
944
958
  * Wait until `text` appears anywhere on the page. `first: true` waits for the first VISIBLE occurrence when the text is duplicated (otherwise duplicates fail strict mode).
945
959
  */
946
- declare function waitForText(text: string | RegExp, options?: any): void;
960
+ declare function waitForText(text: string | RegExp, options?: { [key: string]: unknown }): void;
947
961
 
948
962
  /**
949
963
  * waitForCount(locator, count, { exact?, timeout? })
950
964
  *
951
965
  * Poll until the locator matches AT LEAST `count` elements (`{exact: true}` for exactly). Default timeout 5000 ms.
952
966
  */
953
- declare function waitForCount(locator: Locator, count: number, options?: any): void;
967
+ declare function waitForCount(locator: Locator, count: number, options?: { [key: string]: unknown }): void;
954
968
 
955
969
  /**
956
970
  * waitForAnimations(locator, { timeout? })
957
971
  *
958
972
  * Wait until the element and its descendants have no animation still running — a dialog done fading in, a card done sliding. Infinite ones (spinners) and paused ones are not waited for. Default timeout 5000 ms; a timeout names the element and how many were left.
959
973
  */
960
- declare function waitForAnimations(locator: Locator, options?: any): void;
974
+ declare function waitForAnimations(locator: Locator, options?: { [key: string]: unknown }): void;
961
975
 
962
976
  /**
963
977
  * pause(ms)
@@ -971,7 +985,7 @@ declare function pause(ms: number): void;
971
985
  *
972
986
  * The first file the page downloaded that the scenario has not taken yet, saved with the run: `path` is absolute (read it with waitForFile), `name` is the name the site suggested. Downloads are recorded from the start, so click first, then call this. options: {timeoutMs} (default: the navigation timeout), {name} (substring or regex of the file name).
973
987
  */
974
- declare function waitForDownload(options?: any): any;
988
+ declare function waitForDownload(options?: { [key: string]: unknown }): any;
975
989
 
976
990
  /**
977
991
  * clockFreeze(iso)
@@ -1013,21 +1027,21 @@ declare function unmockRoute(glob?: string): void;
1013
1027
  *
1014
1028
  * Wait for a request matching `glob` and return it; `postDataJson` is the body read as JSON (null when it is not). On a mocked mask it also finds a request sent before the call, each one returned once; on any other mask only requests from the call on. Default timeout 20 s.
1015
1029
  */
1016
- declare function waitForRequest(glob: string, options?: any): any;
1030
+ declare function waitForRequest(glob: string, options?: { [key: string]: unknown }): any;
1017
1031
 
1018
1032
  /**
1019
1033
  * assertNoRequest(glob, { since? })
1020
1034
  *
1021
1035
  * FAIL if the recording abort at `glob` — mockRoute(glob, {abort: true, record: true}) — stopped any request; with `since` (epoch ms, from nowMs()) only from then on. A mask without a recording abort is an error, not a pass.
1022
1036
  */
1023
- declare function assertNoRequest(glob: string, options?: any): void;
1037
+ declare function assertNoRequest(glob: string, options?: { [key: string]: unknown }): void;
1024
1038
 
1025
1039
  /**
1026
1040
  * waitForServiceWorker({ timeoutMs?, url? }) → string
1027
1041
  *
1028
1042
  * Wait for a browser extension's service worker and return its URL (`chrome-extension://<id>/sw.js`); a running one comes back at once. `url` — substring or /regex/ when several extensions run. Extensions load only with `launch.userDataDir`: without it the call fails at once.
1029
1043
  */
1030
- declare function waitForServiceWorker(options?: any): string;
1044
+ declare function waitForServiceWorker(options?: { [key: string]: unknown }): string;
1031
1045
 
1032
1046
  /**
1033
1047
  * extensionId() → string
@@ -1039,9 +1053,9 @@ declare function extensionId(): string;
1039
1053
  /**
1040
1054
  * evaluateInServiceWorker(js, ...args) → any
1041
1055
  *
1042
- * Like evaluate, in the extension's service worker — the way to `chrome.storage`, `chrome.tabs`, `chrome.runtime`. Same argument and JSON-return rules; waits for the worker if none runs. Each call finds the worker anew: MV3 stops an idle one.
1056
+ * Like evaluate, in the extension's service worker — the way to `chrome.storage`, `chrome.tabs`, `chrome.runtime`. `js` is a function or a string; same argument, page-code and JSON-return rules; waits for the worker if none runs. Each call finds the worker anew: MV3 stops an idle one.
1043
1057
  */
1044
- declare function evaluateInServiceWorker(jsBody: string, ...args: unknown[]): any;
1058
+ declare function evaluateInServiceWorker(jsBody: any, ...args: unknown[]): any;
1045
1059
 
1046
1060
  /** step(label, [options,] body)
1047
1061
  *
@@ -1058,3 +1072,20 @@ declare namespace step {
1058
1072
  function soft(label: string, body: () => void): void;
1059
1073
  function soft(label: string, options: { tag: unknown }, body: () => void): void;
1060
1074
  }
1075
+
1076
+ /** teardown(label, body)
1077
+ *
1078
+ * Registers a block that gives the stand back. Nothing runs where it
1079
+ * stands; the block plays after the test, passed or failed, newest
1080
+ * first, and sees the values as they are then. */
1081
+ declare function teardown(label: string, body: () => void): void;
1082
+
1083
+ /** waitUntil(() => condition, options?)
1084
+ *
1085
+ * Runs the body again and again until it gives a truthy value, and
1086
+ * gives that value back. Only a falsy value is retried: an error fails
1087
+ * at once. */
1088
+ declare function waitUntil<T>(
1089
+ condition: () => T,
1090
+ options?: { timeoutMs?: number; intervalMs?: number; label?: string },
1091
+ ): T;