@unotest/web 0.16.0 → 0.18.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.
- package/.claude/skills/write-e2e-test/SKILL.md +6 -1
- package/.claude/skills/write-e2e-test-ground/SKILL.md +6 -1
- package/CHANGELOG.md +84 -75
- package/README.md +8 -0
- package/dist/config/schema.d.ts +9 -9
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +35 -1
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/runner/cli.js +1 -1
- package/dist/runner/init/chrome-probe.js +1 -1
- package/dist/runner/init.d.ts +14 -1
- package/dist/runner/init.js +1 -1
- package/dist/runner/install-chromium.js +1 -1
- package/dist/runner/prepare-fix.js +1 -1
- package/dist/runner/scaffold-workspace.js +1 -1
- package/dist/runner/serve-fixture.js +1 -1
- package/dist/runner/web-runner-adapter.js +1 -1
- package/guides/dsl-reference.md +62 -2
- package/package.json +11 -7
- package/src/mcp/prompts/agent-test-author.md +3 -1
- package/types/unotest-dsl.d.ts +714 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
// GENERATED by scripts/build-dsl-types.ts from the DSL vocabulary — do not edit.
|
|
2
|
+
// Ambient declarations for the unotest DSL: every scenario function is a
|
|
3
|
+
// global, so the editor resolves calls, shows signatures and hover docs.
|
|
4
|
+
|
|
5
|
+
/** A reference to element(s) on the page. Produced by the builders
|
|
6
|
+
* (getByRole, getByTestId, …) and refined by chaining. */
|
|
7
|
+
interface Locator {
|
|
8
|
+
/**
|
|
9
|
+
* filter(locator, { hasText?, hasNotText?, has?, hasNot? })
|
|
10
|
+
*
|
|
11
|
+
* Keep matches by contained text or a nested child locator.
|
|
12
|
+
*/
|
|
13
|
+
filter(options: any): Locator;
|
|
14
|
+
/**
|
|
15
|
+
* first(locator)
|
|
16
|
+
*
|
|
17
|
+
* First match.
|
|
18
|
+
*/
|
|
19
|
+
first(): Locator;
|
|
20
|
+
/**
|
|
21
|
+
* last(locator)
|
|
22
|
+
*
|
|
23
|
+
* Last match.
|
|
24
|
+
*/
|
|
25
|
+
last(): Locator;
|
|
26
|
+
/**
|
|
27
|
+
* nth(locator, index)
|
|
28
|
+
*
|
|
29
|
+
* The N-th match (0-indexed). Index-only refinement is fragile (linter info).
|
|
30
|
+
*/
|
|
31
|
+
nth(index: number): Locator;
|
|
32
|
+
/**
|
|
33
|
+
* randomNth(locator)
|
|
34
|
+
*
|
|
35
|
+
* A random one of the matches — for flows where any item will do.
|
|
36
|
+
*/
|
|
37
|
+
randomNth(): Locator;
|
|
38
|
+
/**
|
|
39
|
+
* locator(css)
|
|
40
|
+
*
|
|
41
|
+
* Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS.
|
|
42
|
+
*/
|
|
43
|
+
locator(selector: string): Locator;
|
|
44
|
+
/**
|
|
45
|
+
* getByRole(role, { name?, exact? })
|
|
46
|
+
*
|
|
47
|
+
* Match by ARIA role + accessible name. `name` accepts a string or `/regex/`.
|
|
48
|
+
*/
|
|
49
|
+
getByRole(role: string, options?: any): Locator;
|
|
50
|
+
/**
|
|
51
|
+
* getByText(text, { exact? })
|
|
52
|
+
*
|
|
53
|
+
* Match by visible text content.
|
|
54
|
+
*/
|
|
55
|
+
getByText(text: string | RegExp, options?: any): Locator;
|
|
56
|
+
/**
|
|
57
|
+
* getByLabel(text, { exact? })
|
|
58
|
+
*
|
|
59
|
+
* Match a form control by its associated label.
|
|
60
|
+
*/
|
|
61
|
+
getByLabel(text: string | RegExp, options?: any): Locator;
|
|
62
|
+
/**
|
|
63
|
+
* getByPlaceholder(text, { exact? })
|
|
64
|
+
*
|
|
65
|
+
* Match an input by its placeholder.
|
|
66
|
+
*/
|
|
67
|
+
getByPlaceholder(text: string | RegExp, options?: any): Locator;
|
|
68
|
+
/**
|
|
69
|
+
* getByAltText(text, { exact? })
|
|
70
|
+
*
|
|
71
|
+
* Match an image by its `alt` text.
|
|
72
|
+
*/
|
|
73
|
+
getByAltText(text: string | RegExp, options?: any): Locator;
|
|
74
|
+
/**
|
|
75
|
+
* getByTitle(text, { exact? })
|
|
76
|
+
*
|
|
77
|
+
* Match by `title` attribute.
|
|
78
|
+
*/
|
|
79
|
+
getByTitle(text: string | RegExp, options?: any): Locator;
|
|
80
|
+
/**
|
|
81
|
+
* getByTestId(id)
|
|
82
|
+
*
|
|
83
|
+
* Match by `data-testid`. Most stable — prefer this.
|
|
84
|
+
*/
|
|
85
|
+
getByTestId(id: string): Locator;
|
|
86
|
+
/**
|
|
87
|
+
* contentFrame(locator)
|
|
88
|
+
*
|
|
89
|
+
* Resolve an `<iframe>` element to its content frame.
|
|
90
|
+
*/
|
|
91
|
+
contentFrame(frame?: Locator): Locator;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* click(locator, { force?, timeout?, noWaitAfter? })
|
|
96
|
+
*
|
|
97
|
+
* Click an element.
|
|
98
|
+
*/
|
|
99
|
+
declare function click(locator: Locator, options?: any): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* doubleClick(locator, { force?, timeout? })
|
|
103
|
+
*
|
|
104
|
+
* Double-click an element.
|
|
105
|
+
*/
|
|
106
|
+
declare function doubleClick(locator: Locator, options?: any): void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* check(locator, { force?, timeout? })
|
|
110
|
+
*
|
|
111
|
+
* Check a checkbox/radio.
|
|
112
|
+
*/
|
|
113
|
+
declare function check(locator: Locator, options?: any): void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* uncheck(locator, { force?, timeout? })
|
|
117
|
+
*
|
|
118
|
+
* Uncheck a checkbox.
|
|
119
|
+
*/
|
|
120
|
+
declare function uncheck(locator: Locator, options?: any): void;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* hover(locator, { force?, timeout? })
|
|
124
|
+
*
|
|
125
|
+
* Hover over an element.
|
|
126
|
+
*/
|
|
127
|
+
declare function hover(locator: Locator, options?: any): void;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* scrollIntoView(locator)
|
|
131
|
+
*
|
|
132
|
+
* Scroll an element into the viewport.
|
|
133
|
+
*/
|
|
134
|
+
declare function scrollIntoView(locator: Locator, options?: any): void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* fill(locator, value, { timeout?, noWaitAfter? })
|
|
138
|
+
*
|
|
139
|
+
* Clear and type a value into an input.
|
|
140
|
+
*/
|
|
141
|
+
declare function fill(locator: Locator, text: string, options?: any): void;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* press(locator, key, { delay?, timeout? })
|
|
145
|
+
*
|
|
146
|
+
* Press a key (e.g. 'Enter', 'Control+A').
|
|
147
|
+
*/
|
|
148
|
+
declare function press(locator: Locator, key: string, options?: any): void;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* selectOption(locator, value, { timeout? })
|
|
152
|
+
*
|
|
153
|
+
* Select option(s) in a `<select>`. `value` is a string or string[].
|
|
154
|
+
*/
|
|
155
|
+
declare function selectOption(locator: Locator, value: any): void;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* dragAndDrop(from, to, { force?, timeout? })
|
|
159
|
+
*
|
|
160
|
+
* Drag one element onto another. Uses synthetic mouse events (not native HTML5 DragEvent).
|
|
161
|
+
*/
|
|
162
|
+
declare function dragAndDrop(source: Locator, target: Locator): void;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* uploadFile(locator, files)
|
|
166
|
+
*
|
|
167
|
+
* Set files on a file input. `files` is a path or path[].
|
|
168
|
+
*/
|
|
169
|
+
declare function uploadFile(input: Locator, files: any): void;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* clipboardPaste(locator, text)
|
|
173
|
+
*
|
|
174
|
+
* Paste text. Synthetic, not a native ClipboardEvent.
|
|
175
|
+
*/
|
|
176
|
+
declare function clipboardPaste(target: Locator, text: string): void;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* assertText(locator, expected, { exact?, timeout? })
|
|
180
|
+
*
|
|
181
|
+
* Element's text equals/contains `expected`.
|
|
182
|
+
*/
|
|
183
|
+
declare function assertText(locator: Locator, text: string, options?: any): void;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* assertVisible(locator, { timeout? })
|
|
187
|
+
*
|
|
188
|
+
* Element is visible.
|
|
189
|
+
*/
|
|
190
|
+
declare function assertVisible(locator: Locator): void;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* assertHidden(locator, { timeout? })
|
|
194
|
+
*
|
|
195
|
+
* Element is hidden or detached.
|
|
196
|
+
*/
|
|
197
|
+
declare function assertHidden(locator: Locator): void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* assertNeverAppears(locator, { withinMs })
|
|
201
|
+
*
|
|
202
|
+
* 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.
|
|
203
|
+
*/
|
|
204
|
+
declare function assertNeverAppears(locator: Locator, options: any): void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* assertValue(locator, expected, { timeout? })
|
|
208
|
+
*
|
|
209
|
+
* Input's value equals `expected`. On a checkbox/radio/switch: its checked state — pass 'true' or 'false'.
|
|
210
|
+
*/
|
|
211
|
+
declare function assertValue(locator: Locator, value: string): void;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* assertCount(locator, expected, { timeout? })
|
|
215
|
+
*
|
|
216
|
+
* Number of matches equals `expected`.
|
|
217
|
+
*/
|
|
218
|
+
declare function assertCount(locator: Locator, count: number): void;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* assertUrl(pattern, { timeout? })
|
|
222
|
+
*
|
|
223
|
+
* Current URL contains `pattern`.
|
|
224
|
+
*/
|
|
225
|
+
declare function assertUrl(pattern: string): void;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* assertTrue(condition, message?)
|
|
229
|
+
*
|
|
230
|
+
* Assert a boolean condition.
|
|
231
|
+
*/
|
|
232
|
+
declare function assertTrue(condition: boolean, message?: string): void;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* filter(locator, { hasText?, hasNotText?, has?, hasNot? })
|
|
236
|
+
*
|
|
237
|
+
* Keep matches by contained text or a nested child locator.
|
|
238
|
+
*/
|
|
239
|
+
declare function filter(receiver: Locator, options: any): Locator;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* first(locator)
|
|
243
|
+
*
|
|
244
|
+
* First match.
|
|
245
|
+
*/
|
|
246
|
+
declare function first(receiver: Locator): Locator;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* last(locator)
|
|
250
|
+
*
|
|
251
|
+
* Last match.
|
|
252
|
+
*/
|
|
253
|
+
declare function last(receiver: Locator): Locator;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* nth(locator, index)
|
|
257
|
+
*
|
|
258
|
+
* The N-th match (0-indexed). Index-only refinement is fragile (linter info).
|
|
259
|
+
*/
|
|
260
|
+
declare function nth(receiver: Locator, index: number): Locator;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* randomNth(locator)
|
|
264
|
+
*
|
|
265
|
+
* A random one of the matches — for flows where any item will do.
|
|
266
|
+
*/
|
|
267
|
+
declare function randomNth(receiver: Locator): Locator;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* screenshot(name?, { fullPage? }) → string
|
|
271
|
+
*
|
|
272
|
+
* Capture the active page into the run's artifact dir; returns the project-relative path.
|
|
273
|
+
*/
|
|
274
|
+
declare function screenshot(name?: string, options?: any): string;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* evaluate(js, ...args) → any
|
|
278
|
+
*
|
|
279
|
+
* Run raw JS in the page context. Last resort — prefer typed helpers. Returns JSON-serializable values only.
|
|
280
|
+
*/
|
|
281
|
+
declare function evaluate(jsBody: string, ...args: unknown[]): any;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* setPage(index)
|
|
285
|
+
*
|
|
286
|
+
* Switch the active tab/page by index (0-based).
|
|
287
|
+
*/
|
|
288
|
+
declare function setPage(indexOrTitle: string | number): void;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* enterFrame(locator)
|
|
292
|
+
*
|
|
293
|
+
* Scope subsequent calls to an iframe (persists until exitFrame).
|
|
294
|
+
*/
|
|
295
|
+
declare function enterFrame(frame: Locator): void;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* exitFrame()
|
|
299
|
+
*
|
|
300
|
+
* Exit the innermost iframe scope.
|
|
301
|
+
*/
|
|
302
|
+
declare function exitFrame(): void;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* goto(url, { waitUntil?, timeout? })
|
|
306
|
+
*
|
|
307
|
+
* Navigate to a URL. `waitUntil`: 'load' | 'domcontentloaded' | 'networkidle'. Relative paths resolve against `baseUrl`.
|
|
308
|
+
*/
|
|
309
|
+
declare function goto(url: string, options?: any): void;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* reload({ waitUntil?, timeout? })
|
|
313
|
+
*
|
|
314
|
+
* Reload the current page.
|
|
315
|
+
*/
|
|
316
|
+
declare function reload(options?: any): void;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* goBack({ timeout? })
|
|
320
|
+
*
|
|
321
|
+
* Navigate back in history.
|
|
322
|
+
*/
|
|
323
|
+
declare function goBack(): void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* goForward({ timeout? })
|
|
327
|
+
*
|
|
328
|
+
* Navigate forward in history.
|
|
329
|
+
*/
|
|
330
|
+
declare function goForward(): void;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* waitForUrl(pattern, { timeout? })
|
|
334
|
+
*
|
|
335
|
+
* Wait until the URL contains `pattern` (substring match).
|
|
336
|
+
*/
|
|
337
|
+
declare function waitForUrl(pattern: string): void;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* waitForNavigation({ timeout? })
|
|
341
|
+
*
|
|
342
|
+
* Wait for the next navigation event.
|
|
343
|
+
*/
|
|
344
|
+
declare function waitForNavigation(options?: any): void;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* count(locator) → number
|
|
348
|
+
*
|
|
349
|
+
* Number of matching elements.
|
|
350
|
+
*/
|
|
351
|
+
declare function count(locator: Locator): number;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* textContent(locator) → string
|
|
355
|
+
*
|
|
356
|
+
* Text content ("" if none).
|
|
357
|
+
*/
|
|
358
|
+
declare function textContent(locator: Locator): string;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* inputValue(locator) → string
|
|
362
|
+
*
|
|
363
|
+
* Current input value.
|
|
364
|
+
*/
|
|
365
|
+
declare function inputValue(locator: Locator): string;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* isVisible(locator) → boolean
|
|
369
|
+
*
|
|
370
|
+
* Whether the element is visible.
|
|
371
|
+
*/
|
|
372
|
+
declare function isVisible(locator: Locator): boolean;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* isDisabled(locator) → boolean
|
|
376
|
+
*
|
|
377
|
+
* Whether the element is disabled (native :disabled incl. fieldset, or aria-disabled).
|
|
378
|
+
*/
|
|
379
|
+
declare function isDisabled(locator: Locator): boolean;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* isEnabled(locator) → boolean
|
|
383
|
+
*
|
|
384
|
+
* Negation of isDisabled.
|
|
385
|
+
*/
|
|
386
|
+
declare function isEnabled(locator: Locator): boolean;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* hasAttribute(locator, name) → boolean
|
|
390
|
+
*
|
|
391
|
+
* Whether the attribute is present at all — the honest probe for boolean attributes.
|
|
392
|
+
*/
|
|
393
|
+
declare function hasAttribute(locator: Locator, name: string): boolean;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* randomFirstName() → string
|
|
397
|
+
*
|
|
398
|
+
* Random first name for fixture data.
|
|
399
|
+
*/
|
|
400
|
+
declare function randomFirstName(): string;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* randomLastName() → string
|
|
404
|
+
*
|
|
405
|
+
* Random last name for fixture data.
|
|
406
|
+
*/
|
|
407
|
+
declare function randomLastName(): string;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* randomEmail() → string
|
|
411
|
+
*
|
|
412
|
+
* Random unique email address for fixture data.
|
|
413
|
+
*/
|
|
414
|
+
declare function randomEmail(): string;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* randomText(length) → string
|
|
418
|
+
*
|
|
419
|
+
* Lorem-style prose cut to `length` characters.
|
|
420
|
+
*/
|
|
421
|
+
declare function randomText(length: number): string;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* randomWord(length?) → string
|
|
425
|
+
*
|
|
426
|
+
* Random lowercase letters (default 8) — digit-free unique markers.
|
|
427
|
+
*/
|
|
428
|
+
declare function randomWord(length?: number): string;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* json(value) → string
|
|
432
|
+
*
|
|
433
|
+
* Serialize any value to a JSON string — readable assert messages for API/data steps: assertTrue(res.status == 202, json(res.body)).
|
|
434
|
+
*/
|
|
435
|
+
declare function json(value: any): string;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* textContains(haystack, needle) → boolean
|
|
439
|
+
*
|
|
440
|
+
* Substring probe for strings (shell stdout, api bodies): assertTrue(textContains(out.stdout, 'ready'), out.stderr).
|
|
441
|
+
*/
|
|
442
|
+
declare function textContains(haystack: string, needle: string): boolean;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* textJoin(parts) → string
|
|
446
|
+
*
|
|
447
|
+
* Concatenate an array of parts (numbers coerced). `+` with a string literal also works; only literal-free `a + b` string addition is rejected (looks like arithmetic).
|
|
448
|
+
*/
|
|
449
|
+
declare function textJoin(parts: unknown[]): string;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* nowMs() → number
|
|
453
|
+
*
|
|
454
|
+
* Current epoch milliseconds.
|
|
455
|
+
*/
|
|
456
|
+
declare function nowMs(): number;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* today() → string
|
|
460
|
+
*
|
|
461
|
+
* Local date as YYYY-MM-DD.
|
|
462
|
+
*/
|
|
463
|
+
declare function today(): string;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* daysFromNow(n) → string
|
|
467
|
+
*
|
|
468
|
+
* Local date n days ahead (negative = past) as YYYY-MM-DD.
|
|
469
|
+
*/
|
|
470
|
+
declare function daysFromNow(days: number): string;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* shell(cmd, ...args, options?) → { stdout, stderr, code }
|
|
474
|
+
*
|
|
475
|
+
* Run a binary (execFile, no shell interpretation). cwd from config `shellCwd`. Non-zero exit FAILS the step unless {allowNonZero: true}; wall-clock budget {timeoutMs} (default 120s).
|
|
476
|
+
*/
|
|
477
|
+
declare function shell(cmd: string, ...args: unknown[]): any;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* waitForFile(path, pattern?, options?) → string
|
|
481
|
+
*
|
|
482
|
+
* 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.
|
|
483
|
+
*/
|
|
484
|
+
declare function waitForFile(path: string, pattern?: any, options?: any): string;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* assertNoFile(path, pattern?, { withinMs })
|
|
488
|
+
*
|
|
489
|
+
* Mirror of waitForFile with inverted polarity: FAIL the moment the file exists (and matches pattern); pass when the window elapsed clean. withinMs required.
|
|
490
|
+
*/
|
|
491
|
+
declare function assertNoFile(path: string, pattern?: any, options?: any): void;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* waitForJsonLine(path, filter, options?) → object
|
|
495
|
+
*
|
|
496
|
+
* 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).
|
|
497
|
+
*/
|
|
498
|
+
declare function waitForJsonLine(path: string, filter: any, options?: any): any;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* assertNoJsonLine(path, filter, { withinMs })
|
|
502
|
+
*
|
|
503
|
+
* Negative twin of waitForJsonLine: FAIL the moment a matching line appears; pass when the window elapsed clean. withinMs required.
|
|
504
|
+
*/
|
|
505
|
+
declare function assertNoJsonLine(path: string, filter: any, options?: any): void;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* waitForFileCount(path, pattern, count, options?) → number
|
|
509
|
+
*
|
|
510
|
+
* 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).
|
|
511
|
+
*/
|
|
512
|
+
declare function waitForFileCount(path: string, pattern: any, count: number, options?: any): number;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* assertFileCount(path, pattern, count)
|
|
516
|
+
*
|
|
517
|
+
* Snapshot count of matching lines, strict equality — 'exactly N happened'. Pair it with waitForFileCount, which awaits the window.
|
|
518
|
+
*/
|
|
519
|
+
declare function assertFileCount(path: string, pattern: any, count: number): void;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* dbQuery(sql, ...params) → rows[]
|
|
523
|
+
*
|
|
524
|
+
* Parameterized SELECT. Dialect from the config `database` URL (postgres/mysql/sqlite).
|
|
525
|
+
*/
|
|
526
|
+
declare function dbQuery(sql: string, ...args: unknown[]): any;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* dbExec(sql, ...params) → number
|
|
530
|
+
*
|
|
531
|
+
* Parameterized INSERT/UPDATE/DELETE. Returns affected row count.
|
|
532
|
+
*/
|
|
533
|
+
declare function dbExec(sql: string, ...args: unknown[]): number;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* apiCall(method, path, body?, headers?) → { status, body, headers }
|
|
537
|
+
*
|
|
538
|
+
* HTTP call. `path` is relative — base is the config `apiBaseUrl`. Multipart: pass upload(...) as the body.
|
|
539
|
+
*/
|
|
540
|
+
declare function apiCall(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS", path: string, body?: any, headers?: any, options?: any): any;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* upload(path, options?) → UploadRef
|
|
544
|
+
*
|
|
545
|
+
* Multipart marker for apiCall's body (options: field, fields). Path is relative to the project root / config `uploadDir`.
|
|
546
|
+
*/
|
|
547
|
+
declare function upload(path: string, options?: any): any;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* locator(css)
|
|
551
|
+
*
|
|
552
|
+
* Match by raw CSS selector. Last resort — the linter warns on deep/brittle CSS.
|
|
553
|
+
*/
|
|
554
|
+
declare function locator(selector: string): Locator;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* getByRole(role, { name?, exact? })
|
|
558
|
+
*
|
|
559
|
+
* Match by ARIA role + accessible name. `name` accepts a string or `/regex/`.
|
|
560
|
+
*/
|
|
561
|
+
declare function getByRole(role: string, options?: any): Locator;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* getByText(text, { exact? })
|
|
565
|
+
*
|
|
566
|
+
* Match by visible text content.
|
|
567
|
+
*/
|
|
568
|
+
declare function getByText(text: string | RegExp, options?: any): Locator;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* getByLabel(text, { exact? })
|
|
572
|
+
*
|
|
573
|
+
* Match a form control by its associated label.
|
|
574
|
+
*/
|
|
575
|
+
declare function getByLabel(text: string | RegExp, options?: any): Locator;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* getByPlaceholder(text, { exact? })
|
|
579
|
+
*
|
|
580
|
+
* Match an input by its placeholder.
|
|
581
|
+
*/
|
|
582
|
+
declare function getByPlaceholder(text: string | RegExp, options?: any): Locator;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* getByAltText(text, { exact? })
|
|
586
|
+
*
|
|
587
|
+
* Match an image by its `alt` text.
|
|
588
|
+
*/
|
|
589
|
+
declare function getByAltText(text: string | RegExp, options?: any): Locator;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* getByTitle(text, { exact? })
|
|
593
|
+
*
|
|
594
|
+
* Match by `title` attribute.
|
|
595
|
+
*/
|
|
596
|
+
declare function getByTitle(text: string | RegExp, options?: any): Locator;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* getByTestId(id)
|
|
600
|
+
*
|
|
601
|
+
* Match by `data-testid`. Most stable — prefer this.
|
|
602
|
+
*/
|
|
603
|
+
declare function getByTestId(id: string): Locator;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* contentFrame(locator)
|
|
607
|
+
*
|
|
608
|
+
* Resolve an `<iframe>` element to its content frame.
|
|
609
|
+
*/
|
|
610
|
+
declare function contentFrame(frame?: Locator): Locator;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* getAttribute(locator, name) → string
|
|
614
|
+
*
|
|
615
|
+
* Attribute value ("" if missing). Boolean attributes (disabled, readonly) read "" whether present or absent — use isDisabled / hasAttribute for those.
|
|
616
|
+
*/
|
|
617
|
+
declare function getAttribute(locator: Locator, attribute: string): string;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* getInnerText(locator) → string
|
|
621
|
+
*
|
|
622
|
+
* Rendered inner text.
|
|
623
|
+
*/
|
|
624
|
+
declare function getInnerText(locator: Locator): string;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* getInputValue(locator) → string
|
|
628
|
+
*
|
|
629
|
+
* Input value (alias of inputValue).
|
|
630
|
+
*/
|
|
631
|
+
declare function getInputValue(locator: Locator): string;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* getTitle() → string
|
|
635
|
+
*
|
|
636
|
+
* Document title of the active page.
|
|
637
|
+
*/
|
|
638
|
+
declare function getTitle(): string;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* getUrl() → string
|
|
642
|
+
*
|
|
643
|
+
* URL of the active page.
|
|
644
|
+
*/
|
|
645
|
+
declare function getUrl(): string;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* log(...args)
|
|
649
|
+
*
|
|
650
|
+
* Write to the run trace.
|
|
651
|
+
*/
|
|
652
|
+
declare function log(message: any, ...args: unknown[]): void;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* setLocalStorage(key, value)
|
|
656
|
+
*
|
|
657
|
+
* Set a localStorage item.
|
|
658
|
+
*/
|
|
659
|
+
declare function setLocalStorage(key: string, value: string): void;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* getLocalStorage(key) → string
|
|
663
|
+
*
|
|
664
|
+
* Read a localStorage item ("" if missing).
|
|
665
|
+
*/
|
|
666
|
+
declare function getLocalStorage(key: string): string;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* setCookie(name, value, options?)
|
|
670
|
+
*
|
|
671
|
+
* Set a cookie (options: path, domain, expires, httpOnly, secure, sameSite).
|
|
672
|
+
*/
|
|
673
|
+
declare function setCookie(name: string, value: string, options?: any): void;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* getCookie(name) → string
|
|
677
|
+
*
|
|
678
|
+
* Read a cookie value ("" if missing).
|
|
679
|
+
*/
|
|
680
|
+
declare function getCookie(name: string): string;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* waitFor(locator, { state?, timeout? })
|
|
684
|
+
*
|
|
685
|
+
* Wait for an element state: DOM presence ('visible' default, 'hidden', 'attached', 'detached') or interaction ('enabled' / 'disabled' — same probe as isEnabled, so aria-disabled counts).
|
|
686
|
+
*/
|
|
687
|
+
declare function waitFor(locator: Locator, options?: any): void;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* waitForText(text, { first?, timeout? })
|
|
691
|
+
*
|
|
692
|
+
* 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).
|
|
693
|
+
*/
|
|
694
|
+
declare function waitForText(text: string | RegExp, options?: any): void;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* waitForCount(locator, count, { exact?, timeout? })
|
|
698
|
+
*
|
|
699
|
+
* Poll until the locator matches AT LEAST `count` elements (`{exact: true}` for exactly). Default timeout 5000 ms.
|
|
700
|
+
*/
|
|
701
|
+
declare function waitForCount(locator: Locator, count: number, options?: any): void;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* pause(ms)
|
|
705
|
+
*
|
|
706
|
+
* Explicit delay. Discouraged — the linter wants a `// reason:` comment. Prefer a `waitFor*`.
|
|
707
|
+
*/
|
|
708
|
+
declare function pause(ms: number): void;
|
|
709
|
+
|
|
710
|
+
/** step(label, body)
|
|
711
|
+
*
|
|
712
|
+
* Groups statements under a labelled block. Every direct child of a
|
|
713
|
+
* test_* function must sit inside a step(...). */
|
|
714
|
+
declare function step(label: string, body: () => void): void;
|