@unotest/web 0.52.1 → 0.53.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/CHANGELOG.md +168 -3
- package/README.md +5 -3
- package/dist/config/schema.d.ts +11 -11
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +7 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +333 -92
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/v8/scenario-worker.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +11 -3
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +5 -2
- package/dist/inspection/page-inject.js +11 -0
- package/dist/{interfaces-BSGmF_Tv.d.ts → interfaces-BU-PQbt4.d.ts} +48 -2
- package/dist/{linter-CYRlmOLy.d.ts → linter-BpaIstU3.d.ts} +11 -1
- package/dist/mcp/server.js +1 -1
- package/dist/runner/cli.d.ts +1 -1
- package/dist/runner/cli.js +1 -1
- package/dist/runner/init/chrome-probe.js +1 -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/agent-integration.md +1 -1
- package/guides/dsl-reference.md +485 -40
- package/llms.txt +14 -9
- package/package.json +13 -8
- package/src/mcp/prompts/agent-test-author.md +3 -1
- package/types/unotest-dsl.d.ts +52 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectedDomHelpers } from '@unotest/grounder-client/dom-walker';
|
|
2
2
|
import { PickerMode } from '@unotest/protocol';
|
|
3
|
-
import { E as ElementHint, A as AnimationInfo } from '../interfaces-
|
|
3
|
+
import { E as ElementHint, A as AnimationInfo } from '../interfaces-BU-PQbt4.js';
|
|
4
4
|
import '../config/schema.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
@@ -459,6 +459,9 @@ interface ImageState {
|
|
|
459
459
|
declare function readImageState(el: Element): ImageState;
|
|
460
460
|
/** Whether an `<img>` has settled — the predicate `getImageSize` waits on. */
|
|
461
461
|
declare function isImageComplete(el: Element): boolean;
|
|
462
|
+
/** Whether any element of the document has a backdrop filter. WebKit exposes
|
|
463
|
+
* the property unprefixed or as `-webkit-backdrop-filter`: both are read. */
|
|
464
|
+
declare function pageHasBackdropFilter(): boolean;
|
|
462
465
|
/** Write a localStorage item. Key and value travel as one array because
|
|
463
466
|
* Playwright's `evaluate(fn, arg)` passes a SINGLE argument. */
|
|
464
467
|
declare function writeLocalStorageItem([key, value]: [string, string]): void;
|
|
@@ -491,4 +494,4 @@ declare function inspectElementRaw(el: Element, args: {
|
|
|
491
494
|
};
|
|
492
495
|
}): ElementHintRaw;
|
|
493
496
|
|
|
494
|
-
export { type ElementHintRaw, type ImageState, ariaSnapshotAlgorithm, endsByItself, findElementAlgorithm, inspectElementRaw, isImageComplete, outlineAlgorithm, pasteValue, pickerOverlayAlgorithm, readAnimations, readCheckedState, readClipboardText, readComputedStyle, readDisabledState, readImageState, readLocalStorageItem, readOptionLabels, semanticDomAlgorithm, serializeRuntimeDom, writeDisplayMode, writeDocumentHidden, writeLocalStorageItem };
|
|
497
|
+
export { type ElementHintRaw, type ImageState, ariaSnapshotAlgorithm, endsByItself, findElementAlgorithm, inspectElementRaw, isImageComplete, outlineAlgorithm, pageHasBackdropFilter, pasteValue, pickerOverlayAlgorithm, readAnimations, readCheckedState, readClipboardText, readComputedStyle, readDisabledState, readImageState, readLocalStorageItem, readOptionLabels, semanticDomAlgorithm, serializeRuntimeDom, writeDisplayMode, writeDocumentHidden, writeLocalStorageItem };
|
|
@@ -2848,6 +2848,16 @@ function isImageComplete(el) {
|
|
|
2848
2848
|
return el.complete;
|
|
2849
2849
|
}
|
|
2850
2850
|
__name(isImageComplete, "isImageComplete");
|
|
2851
|
+
function pageHasBackdropFilter() {
|
|
2852
|
+
globalThis.__name ??= (fn) => fn;
|
|
2853
|
+
for (const el of Array.from(document.querySelectorAll("*"))) {
|
|
2854
|
+
const style = getComputedStyle(el);
|
|
2855
|
+
const value = style.backdropFilter || style.webkitBackdropFilter;
|
|
2856
|
+
if (value && value !== "none") return true;
|
|
2857
|
+
}
|
|
2858
|
+
return false;
|
|
2859
|
+
}
|
|
2860
|
+
__name(pageHasBackdropFilter, "pageHasBackdropFilter");
|
|
2851
2861
|
function writeLocalStorageItem([key, value]) {
|
|
2852
2862
|
globalThis.__name ??= (fn) => fn;
|
|
2853
2863
|
localStorage.setItem(key, value);
|
|
@@ -3100,6 +3110,7 @@ export {
|
|
|
3100
3110
|
inspectElementRaw,
|
|
3101
3111
|
isImageComplete,
|
|
3102
3112
|
outlineAlgorithm,
|
|
3113
|
+
pageHasBackdropFilter,
|
|
3103
3114
|
pasteValue,
|
|
3104
3115
|
pickerOverlayAlgorithm,
|
|
3105
3116
|
readAnimations,
|
|
@@ -313,6 +313,12 @@ interface AttachOptions extends Pick<ContextOptions, "dialogPolicy"> {
|
|
|
313
313
|
contextId?: string;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
/** How `connectShared` joins a browser. */
|
|
317
|
+
interface ConnectSharedOptions {
|
|
318
|
+
/** Give up on the connection after this long. Absent → the browser
|
|
319
|
+
* library's own wait (30 s for Playwright), as debug-attach has it. */
|
|
320
|
+
timeoutMs?: number;
|
|
321
|
+
}
|
|
316
322
|
interface WebDriver {
|
|
317
323
|
/**
|
|
318
324
|
* Launch the underlying browser process. Idempotent — subsequent calls
|
|
@@ -326,6 +332,13 @@ interface WebDriver {
|
|
|
326
332
|
* each test calls newContext() at start and ctx.close() at end.
|
|
327
333
|
*/
|
|
328
334
|
newContext(opts?: ContextOptions): Promise<DriverContext>;
|
|
335
|
+
/**
|
|
336
|
+
* A context on its own persistent browser profile, the directory `dir`
|
|
337
|
+
* (absolute; the caller made it and keeps it). Its cookies and storage
|
|
338
|
+
* live in that directory, apart from every other context's; closing the
|
|
339
|
+
* context closes its browser. Several can be open at once.
|
|
340
|
+
*/
|
|
341
|
+
newProfileContext(dir: string, opts?: ContextOptions): Promise<DriverContext>;
|
|
329
342
|
/**
|
|
330
343
|
* Tear down all open contexts and the browser process. Idempotent.
|
|
331
344
|
* Errors logged but not re-thrown (must not mask test failures in
|
|
@@ -347,7 +360,7 @@ interface WebDriver {
|
|
|
347
360
|
* Drivers that don't support sharing throw from connect/attach.
|
|
348
361
|
*/
|
|
349
362
|
wsEndpoint(): string | undefined;
|
|
350
|
-
connectShared(wsEndpoint: string, browser: LaunchOptions["browser"]): Promise<void>;
|
|
363
|
+
connectShared(wsEndpoint: string, browser: LaunchOptions["browser"], opts?: ConnectSharedOptions): Promise<void>;
|
|
351
364
|
attachExisting(opts?: AttachOptions): Promise<DriverContext>;
|
|
352
365
|
/** True while the browser `connectShared` joined is still there. A run
|
|
353
366
|
* on `launch.profile: "per-test"` closes it with each test and starts
|
|
@@ -375,6 +388,31 @@ interface NetworkEntry {
|
|
|
375
388
|
* aborted it. Absent for requests a mock let through. */
|
|
376
389
|
mocked?: true;
|
|
377
390
|
}
|
|
391
|
+
/** One request of the active page and what came back, kept always — from
|
|
392
|
+
* the page's opening — for `networkEntries` in a scenario. Bodies are read
|
|
393
|
+
* only for `fetch` / `xhr` with a text or JSON content type, at most
|
|
394
|
+
* 64 KB each (`truncated`); every other resource has its status only. */
|
|
395
|
+
interface PageNetworkEntry {
|
|
396
|
+
url: string;
|
|
397
|
+
method: string;
|
|
398
|
+
/** 0 when the request failed before any response. */
|
|
399
|
+
status: number;
|
|
400
|
+
ok: boolean;
|
|
401
|
+
failureText?: string;
|
|
402
|
+
/** A `mockRoute` answered or aborted it. */
|
|
403
|
+
mocked?: true;
|
|
404
|
+
/** The request body read as JSON; null when there is none or it is not
|
|
405
|
+
* JSON. As `postDataJson` of `waitForRequest`. */
|
|
406
|
+
requestJson: unknown;
|
|
407
|
+
/** The response body read as JSON; null when it is not JSON or was not read. */
|
|
408
|
+
responseJson: unknown;
|
|
409
|
+
/** The response body of a text content type; null otherwise. */
|
|
410
|
+
responseText: string | null;
|
|
411
|
+
/** A body was cut at the cap; `responseJson` is then null. */
|
|
412
|
+
truncated?: true;
|
|
413
|
+
/** When the request was sent, epoch ms (as `nowMs()`). */
|
|
414
|
+
at: number;
|
|
415
|
+
}
|
|
378
416
|
/** A file a page of the context downloaded. The bytes stay with the
|
|
379
417
|
* browser until `saveAs` copies them out. */
|
|
380
418
|
interface DriverDownload {
|
|
@@ -651,6 +689,11 @@ interface DriverContext {
|
|
|
651
689
|
* `network.json` for the viewer's Network tab.
|
|
652
690
|
*/
|
|
653
691
|
networkEntries(): ReadonlyArray<NetworkEntry>;
|
|
692
|
+
/**
|
|
693
|
+
* What the active page requested and was answered, oldest first. Recorded
|
|
694
|
+
* always (500 entries per context), unlike `networkEntries()`.
|
|
695
|
+
*/
|
|
696
|
+
pageNetwork(): ReadonlyArray<PageNetworkEntry>;
|
|
654
697
|
/**
|
|
655
698
|
* The first download of this context the scenario has not taken yet,
|
|
656
699
|
* waiting up to `timeoutMs` (default: the navigation budget) for one.
|
|
@@ -807,6 +850,9 @@ interface DriverPage {
|
|
|
807
850
|
* logging to persist "what did this locator actually resolve to" as
|
|
808
851
|
* agent-readable proof — NOT part of the DSL / action surface. */
|
|
809
852
|
outerHTML(loc: LocatorValue): Promise<string | null>;
|
|
853
|
+
/** Whether any element of the main frame has a computed backdrop filter.
|
|
854
|
+
* Read before a screenshot, to warn where the engine does not draw one. */
|
|
855
|
+
hasBackdropFilter(): Promise<boolean>;
|
|
810
856
|
}
|
|
811
857
|
/**
|
|
812
858
|
* Identifying attributes of a single DOM element. Populated by
|
|
@@ -975,4 +1021,4 @@ interface PageConsole {
|
|
|
975
1021
|
errors: readonly PageErrorEntry[];
|
|
976
1022
|
}
|
|
977
1023
|
|
|
978
|
-
export { type AnimationInfo as A, type BoundingBox as B, type CaptureFrame as C, type DriverContext as D, type ElementHint as E, type FillOptions as F, type GotoOptions as G, type HoverOptions as H, type ImageSize as I, type LocatorValue as L, type NetworkEntry as N, type PageConsole as P, type ReloadOptions as R, type ScreenshotOptions as S, type VirtualCredential as V, type WebDriver as W, type CaptureRect as a, type
|
|
1024
|
+
export { type AnimationInfo as A, type BoundingBox as B, type CaptureFrame as C, type DriverContext as D, type ElementHint as E, type FillOptions as F, type GotoOptions as G, type HoverOptions as H, type ImageSize as I, type LocatorValue as L, type NetworkEntry as N, type PageConsole as P, type ReloadOptions as R, type ScreenshotOptions as S, type VirtualCredential as V, type WebDriver as W, type CaptureRect as a, type PageNetworkEntry as b, type LaunchOptions as c, type ContextOptions as d, type AttachOptions as e, type ActionTimeout as f, type CheckOptions as g, type ClickOptions as h, type CookieOptions as i, type DriverPage as j, type NavigationOptions as k, type PressOptions as l, type SelectOptions as m, type Viewport as n, type ViewportSize as o, type WaitOptions as p, type WaitState as q, type DriverDownload as r, type LocatorStep as s, appendStep as t, describeLocator as u, isLocatorValue as v, rootedAt as w };
|
|
@@ -78,6 +78,16 @@ interface LintOptions {
|
|
|
78
78
|
/** The file's comments (`ParsedScenario.comments`): what an author wrote
|
|
79
79
|
* next to a line is read as its reason by `lint:typed-step-available`. */
|
|
80
80
|
comments?: readonly LintComment[];
|
|
81
|
+
/** The budget of a test in this project (`resolveTestBudget`): what
|
|
82
|
+
* `lint:wait-exceeds-test-budget` measures a wait against when the test
|
|
83
|
+
* sets none of its own. Absent → the rule only knows `setTestTimeout`
|
|
84
|
+
* literals. */
|
|
85
|
+
testBudget?: TestBudgetHint;
|
|
86
|
+
}
|
|
87
|
+
/** A test's time budget and the setting it comes from. */
|
|
88
|
+
interface TestBudgetHint {
|
|
89
|
+
ms: number;
|
|
90
|
+
setting: string;
|
|
81
91
|
}
|
|
82
92
|
/** Lint a parsed file (`ParsedScenario.program`) or any node in one. */
|
|
83
93
|
declare function lintAst(ast: ESTree.Node, opts?: LintOptions): LintDiagnostic[];
|
|
@@ -89,4 +99,4 @@ interface LintComment {
|
|
|
89
99
|
text: string;
|
|
90
100
|
}
|
|
91
101
|
|
|
92
|
-
export { type ExternalVariableLookup as E, type LintDiagnostic as L, type LintSeverity as a, type LintOptions as b, lintAst as l };
|
|
102
|
+
export { type ExternalVariableLookup as E, type LintDiagnostic as L, type TestBudgetHint as T, type LintSeverity as a, type LintOptions as b, lintAst as l };
|