@unotest/web 0.50.0 → 0.51.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 +110 -3
- package/README.md +25 -0
- package/dist/config/schema.d.ts +40 -18
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +11 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +350 -3
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +1 -1
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +34 -7
- package/dist/inspection/page-inject.js +69 -4
- package/dist/{interfaces--zgFOUB6.d.ts → interfaces-BSGmF_Tv.d.ts} +92 -3
- package/dist/{linter-Ci17V2Sr.d.ts → linter-CYRlmOLy.d.ts} +19 -0
- 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 +25 -2
- package/guides/dsl-reference.md +807 -38
- package/llms.txt +223 -0
- package/package.json +9 -8
- package/types/unotest-dsl.d.ts +328 -101
|
@@ -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 } from '../interfaces
|
|
3
|
+
import { E as ElementHint, A as AnimationInfo } from '../interfaces-BSGmF_Tv.js';
|
|
4
4
|
import '../config/schema.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
@@ -417,6 +417,8 @@ declare function findElementAlgorithm(h: InjectedDomHelpers, args: {
|
|
|
417
417
|
* wire-only `ref` the caller adds when mapping. Type-only import — erased
|
|
418
418
|
* at runtime, so the serialized functions stay self-contained. */
|
|
419
419
|
type ElementHintRaw = Omit<ElementHint, "ref">;
|
|
420
|
+
/** The clipboard's text, as the page reads it. */
|
|
421
|
+
declare function readClipboardText(): Promise<string>;
|
|
420
422
|
/** Set an input/textarea value via the native setter + fire input/change. */
|
|
421
423
|
declare function pasteValue(el: Element, pasted: string): void;
|
|
422
424
|
/** Checked state of a checkbox / radio / ARIA widget — `null` when the
|
|
@@ -429,11 +431,19 @@ declare function readDisabledState(el: Element): boolean;
|
|
|
429
431
|
/** Computed value of one CSS property — custom properties included, which
|
|
430
432
|
* `getPropertyValue` returns with the whitespace after their colon. */
|
|
431
433
|
declare function readComputedStyle(el: Element, property: string): string;
|
|
432
|
-
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
|
|
436
|
-
|
|
434
|
+
/** The visible labels of a `<select>`'s options, in order — what a
|
|
435
|
+
* select by `{label}` matches against and `{index}` counts. Anything
|
|
436
|
+
* but a `<select>` has none. */
|
|
437
|
+
declare function readOptionLabels(el: Element): string[];
|
|
438
|
+
/** Every animation of the element and its descendants, finished, paused
|
|
439
|
+
* and infinite ones too: CSS animations by their `@keyframes` name, CSS
|
|
440
|
+
* transitions by the property they move, script ones by their `id`. */
|
|
441
|
+
declare function readAnimations(el: Element): AnimationInfo[];
|
|
442
|
+
/** Whether an animation is still playing towards an end — the rule
|
|
443
|
+
* `hasAnimation` and `waitForAnimations` go by. An infinite one (a
|
|
444
|
+
* spinner) never ends, so waiting for it could only time out; a paused
|
|
445
|
+
* one ends only when the page resumes it. Neither counts. */
|
|
446
|
+
declare function endsByItself(a: AnimationInfo): boolean;
|
|
437
447
|
/** What `getImageSize` reads off an element: its tag, whether the image
|
|
438
448
|
* has settled (`complete`: loaded, failed, or nothing to load), its
|
|
439
449
|
* natural size, and whether it is lazy — a lazy image outside the
|
|
@@ -454,6 +464,23 @@ declare function isImageComplete(el: Element): boolean;
|
|
|
454
464
|
declare function writeLocalStorageItem([key, value]: [string, string]): void;
|
|
455
465
|
/** Read a localStorage item (`null` when absent). */
|
|
456
466
|
declare function readLocalStorageItem(key: string): string | null;
|
|
467
|
+
/** Make the document report itself hidden or visible to its scripts:
|
|
468
|
+
* `document.hidden`, `visibilityState`, `hasFocus()`. With `announce` it
|
|
469
|
+
* fires what a tab switch fires — `blur` then `visibilitychange` on hiding,
|
|
470
|
+
* `visibilitychange` then `focus` on showing. Without it only the state is
|
|
471
|
+
* set: the init script of a hidden tab's next document, which was never
|
|
472
|
+
* visible. Hidden and flag travel as one array: `evaluate(fn, arg)` passes
|
|
473
|
+
* a SINGLE argument. */
|
|
474
|
+
declare function writeDocumentHidden([hidden, announce]: [boolean, boolean]): void;
|
|
475
|
+
/** Make the document's scripts see the app launched in `mode` (`standalone`
|
|
476
|
+
* for one added to the home screen): `matchMedia('(display-mode: …)')`
|
|
477
|
+
* answers for that mode, and `navigator.standalone` — where the engine
|
|
478
|
+
* has it, as WebKit does — says whether it is standalone. No engine
|
|
479
|
+
* emulates the feature itself, so CSS `@media (display-mode: …)` and a
|
|
480
|
+
* query combining it with other features still see the browser; the
|
|
481
|
+
* config reference says so. The answer is the real list object (listeners,
|
|
482
|
+
* `onchange`) of a query that is always true or always false. */
|
|
483
|
+
declare function writeDisplayMode(mode: string): void;
|
|
457
484
|
/** Read every identifying attribute off a live element (role inferred from
|
|
458
485
|
* tag + ARIA, accname approximated). Returns a structured raw hint. */
|
|
459
486
|
declare function inspectElementRaw(el: Element, args: {
|
|
@@ -464,4 +491,4 @@ declare function inspectElementRaw(el: Element, args: {
|
|
|
464
491
|
};
|
|
465
492
|
}): ElementHintRaw;
|
|
466
493
|
|
|
467
|
-
export { type ElementHintRaw, type ImageState, ariaSnapshotAlgorithm,
|
|
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 };
|
|
@@ -2758,6 +2758,10 @@ function findElementAlgorithm(h, args) {
|
|
|
2758
2758
|
__name(findElementAlgorithm, "findElementAlgorithm");
|
|
2759
2759
|
|
|
2760
2760
|
// src/inspection/page-dom.ts
|
|
2761
|
+
function readClipboardText() {
|
|
2762
|
+
return navigator.clipboard.readText();
|
|
2763
|
+
}
|
|
2764
|
+
__name(readClipboardText, "readClipboardText");
|
|
2761
2765
|
function pasteValue(el, pasted) {
|
|
2762
2766
|
const input = el;
|
|
2763
2767
|
const setter = Object.getOwnPropertyDescriptor(
|
|
@@ -2802,11 +2806,29 @@ function readComputedStyle(el, property) {
|
|
|
2802
2806
|
return getComputedStyle(el).getPropertyValue(property).trim();
|
|
2803
2807
|
}
|
|
2804
2808
|
__name(readComputedStyle, "readComputedStyle");
|
|
2805
|
-
function
|
|
2809
|
+
function readOptionLabels(el) {
|
|
2806
2810
|
globalThis.__name ??= (fn) => fn;
|
|
2807
|
-
return el
|
|
2811
|
+
return el instanceof HTMLSelectElement ? Array.from(el.options, (o) => o.label) : [];
|
|
2808
2812
|
}
|
|
2809
|
-
__name(
|
|
2813
|
+
__name(readOptionLabels, "readOptionLabels");
|
|
2814
|
+
function readAnimations(el) {
|
|
2815
|
+
globalThis.__name ??= (fn) => fn;
|
|
2816
|
+
return el.getAnimations({ subtree: true }).map((a) => {
|
|
2817
|
+
const time = a.currentTime;
|
|
2818
|
+
return {
|
|
2819
|
+
name: a instanceof CSSAnimation ? a.animationName : a instanceof CSSTransition ? a.transitionProperty : a.id,
|
|
2820
|
+
kind: a instanceof CSSAnimation ? "animation" : a instanceof CSSTransition ? "transition" : "script",
|
|
2821
|
+
playState: a.playState,
|
|
2822
|
+
currentTime: typeof time === "number" ? time : null,
|
|
2823
|
+
infinite: a.effect?.getComputedTiming().iterations === Infinity
|
|
2824
|
+
};
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
__name(readAnimations, "readAnimations");
|
|
2828
|
+
function endsByItself(a) {
|
|
2829
|
+
return a.playState === "running" && !a.infinite;
|
|
2830
|
+
}
|
|
2831
|
+
__name(endsByItself, "endsByItself");
|
|
2810
2832
|
function readImageState(el) {
|
|
2811
2833
|
globalThis.__name ??= (fn) => fn;
|
|
2812
2834
|
const tag = el.tagName.toLowerCase();
|
|
@@ -2836,6 +2858,44 @@ function readLocalStorageItem(key) {
|
|
|
2836
2858
|
return localStorage.getItem(key);
|
|
2837
2859
|
}
|
|
2838
2860
|
__name(readLocalStorageItem, "readLocalStorageItem");
|
|
2861
|
+
function writeDocumentHidden([hidden, announce]) {
|
|
2862
|
+
globalThis.__name ??= (fn) => fn;
|
|
2863
|
+
if (hidden) {
|
|
2864
|
+
Object.defineProperty(document, "visibilityState", { configurable: true, get: /* @__PURE__ */ __name(() => "hidden", "get") });
|
|
2865
|
+
Object.defineProperty(document, "hidden", { configurable: true, get: /* @__PURE__ */ __name(() => true, "get") });
|
|
2866
|
+
Object.defineProperty(document, "hasFocus", { configurable: true, value: /* @__PURE__ */ __name(() => false, "value") });
|
|
2867
|
+
} else {
|
|
2868
|
+
for (const key of ["visibilityState", "hidden", "hasFocus"]) Reflect.deleteProperty(document, key);
|
|
2869
|
+
}
|
|
2870
|
+
if (!announce) return;
|
|
2871
|
+
if (hidden) window.dispatchEvent(new FocusEvent("blur"));
|
|
2872
|
+
document.dispatchEvent(new Event("visibilitychange", { bubbles: true }));
|
|
2873
|
+
if (!hidden) window.dispatchEvent(new FocusEvent("focus"));
|
|
2874
|
+
}
|
|
2875
|
+
__name(writeDocumentHidden, "writeDocumentHidden");
|
|
2876
|
+
function writeDisplayMode(mode) {
|
|
2877
|
+
globalThis.__name ??= (fn) => fn;
|
|
2878
|
+
const original = window.matchMedia.bind(window);
|
|
2879
|
+
function askedMode(query) {
|
|
2880
|
+
const q = query.trim().toLowerCase();
|
|
2881
|
+
if (!q.startsWith("(") || !q.endsWith(")")) return void 0;
|
|
2882
|
+
const [feature, value, ...rest] = q.slice(1, -1).split(":");
|
|
2883
|
+
if (rest.length > 0 || feature?.trim() !== "display-mode" || value === void 0) return void 0;
|
|
2884
|
+
return value.trim();
|
|
2885
|
+
}
|
|
2886
|
+
__name(askedMode, "askedMode");
|
|
2887
|
+
window.matchMedia = (query) => {
|
|
2888
|
+
const asked = askedMode(query);
|
|
2889
|
+
if (asked === void 0) return original(query);
|
|
2890
|
+
const list = original(asked === mode ? "all" : "not all");
|
|
2891
|
+
Object.defineProperty(list, "media", { configurable: true, value: query });
|
|
2892
|
+
return list;
|
|
2893
|
+
};
|
|
2894
|
+
if ("standalone" in navigator) {
|
|
2895
|
+
Object.defineProperty(navigator, "standalone", { configurable: true, get: /* @__PURE__ */ __name(() => mode === "standalone", "get") });
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
__name(writeDisplayMode, "writeDisplayMode");
|
|
2839
2899
|
function inspectElementRaw(el, args) {
|
|
2840
2900
|
globalThis.__name ??= (fn) => fn;
|
|
2841
2901
|
const e = el;
|
|
@@ -3035,20 +3095,25 @@ function inspectElementRaw(el, args) {
|
|
|
3035
3095
|
__name(inspectElementRaw, "inspectElementRaw");
|
|
3036
3096
|
export {
|
|
3037
3097
|
ariaSnapshotAlgorithm,
|
|
3038
|
-
|
|
3098
|
+
endsByItself,
|
|
3039
3099
|
findElementAlgorithm,
|
|
3040
3100
|
inspectElementRaw,
|
|
3041
3101
|
isImageComplete,
|
|
3042
3102
|
outlineAlgorithm,
|
|
3043
3103
|
pasteValue,
|
|
3044
3104
|
pickerOverlayAlgorithm,
|
|
3105
|
+
readAnimations,
|
|
3045
3106
|
readCheckedState,
|
|
3107
|
+
readClipboardText,
|
|
3046
3108
|
readComputedStyle,
|
|
3047
3109
|
readDisabledState,
|
|
3048
3110
|
readImageState,
|
|
3049
3111
|
readLocalStorageItem,
|
|
3112
|
+
readOptionLabels,
|
|
3050
3113
|
semanticDomAlgorithm,
|
|
3051
3114
|
serializeRuntimeDom,
|
|
3115
|
+
writeDisplayMode,
|
|
3116
|
+
writeDocumentHidden,
|
|
3052
3117
|
writeLocalStorageItem
|
|
3053
3118
|
};
|
|
3054
3119
|
//# sourceMappingURL=page-inject.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Matcher } from '@unotest/protocol';
|
|
2
|
-
import { Browser, BrowserChannel } from './config/schema.js';
|
|
2
|
+
import { DisplayMode, Browser, BrowserChannel } from './config/schema.js';
|
|
3
3
|
|
|
4
4
|
type LocatorStep = {
|
|
5
5
|
kind: 'css';
|
|
@@ -120,6 +120,9 @@ interface ContextOptions {
|
|
|
120
120
|
device?: string;
|
|
121
121
|
/** `null` — the real browser window, no size emulation. */
|
|
122
122
|
viewport?: Viewport | null;
|
|
123
|
+
/** The launch mode every page's scripts see (`config.displayMode`):
|
|
124
|
+
* set before the first document of each page. Unset → the browser's. */
|
|
125
|
+
displayMode?: DisplayMode;
|
|
123
126
|
/** Put a fake clock on the context before its first page loads, so that
|
|
124
127
|
* every timer the pages set is under `DriverContext.clock()`. Off by
|
|
125
128
|
* default: time on the page is the real one. */
|
|
@@ -388,6 +391,32 @@ interface DownloadNameFilter {
|
|
|
388
391
|
}
|
|
389
392
|
/** A fake clock shared by every page of a context. Time runs by itself
|
|
390
393
|
* until `freeze`, and again after `run`. */
|
|
394
|
+
/** A virtual authenticator's make-up — CDP's VirtualAuthenticatorOptions.
|
|
395
|
+
* Every field optional: the default is the passkey of a phone or laptop. */
|
|
396
|
+
interface VirtualAuthenticatorOptions {
|
|
397
|
+
protocol?: "ctap2" | "u2f";
|
|
398
|
+
transport?: "internal" | "usb" | "nfc" | "ble" | "cable";
|
|
399
|
+
hasResidentKey?: boolean;
|
|
400
|
+
hasUserVerification?: boolean;
|
|
401
|
+
isUserVerified?: boolean;
|
|
402
|
+
automaticPresenceSimulation?: boolean;
|
|
403
|
+
}
|
|
404
|
+
/** A credential a virtual authenticator holds. Ids are base64url, as
|
|
405
|
+
* the page's `PublicKeyCredential.id` spells them. */
|
|
406
|
+
interface VirtualCredential {
|
|
407
|
+
credentialId: string;
|
|
408
|
+
rpId: string | null;
|
|
409
|
+
userHandle: string | null;
|
|
410
|
+
signCount: number;
|
|
411
|
+
resident: boolean;
|
|
412
|
+
}
|
|
413
|
+
interface DriverWebAuthn {
|
|
414
|
+
/** Attach an authenticator to the active page; returns its id. */
|
|
415
|
+
add(opts: VirtualAuthenticatorOptions): Promise<string>;
|
|
416
|
+
/** The credentials of one authenticator, or of all of them. */
|
|
417
|
+
credentials(id?: string): Promise<VirtualCredential[]>;
|
|
418
|
+
remove(id: string): Promise<void>;
|
|
419
|
+
}
|
|
391
420
|
/** Media features a page can be made to report — Playwright's values. */
|
|
392
421
|
interface EmulatedMedia {
|
|
393
422
|
reducedMotion?: "reduce" | "no-preference";
|
|
@@ -485,6 +514,15 @@ interface DriverContext {
|
|
|
485
514
|
* target. Absent index → the active page. Throws `DriverError` on an
|
|
486
515
|
* index no open tab has. */
|
|
487
516
|
bringToFront(index?: number): Promise<void>;
|
|
517
|
+
/** Make a tab's scripts see it hidden — `document.hidden` true,
|
|
518
|
+
* `visibilityState` 'hidden', `hasFocus()` false, `blur` then
|
|
519
|
+
* `visibilitychange` — or visible again (`visibilitychange` then
|
|
520
|
+
* `focus`). Emulated in the document of every frame: no engine hides a
|
|
521
|
+
* tab of a headless browser, so timers, animation frames and the page
|
|
522
|
+
* lifecycle run on. A hidden tab stays hidden across navigations until
|
|
523
|
+
* shown; asking for the state it is in changes nothing. Absent index →
|
|
524
|
+
* the active page. Throws `DriverError` on an index no open tab has. */
|
|
525
|
+
setPageHidden(hidden: boolean, index?: number): Promise<void>;
|
|
488
526
|
/** Open a blank tab in this context and make it the active page (brought
|
|
489
527
|
* to front, frame stack reset). It counts as handed: `waitForNewPage`
|
|
490
528
|
* never returns it. Resolves with its index. */
|
|
@@ -558,6 +596,17 @@ interface DriverContext {
|
|
|
558
596
|
clock(): DriverClock;
|
|
559
597
|
/** Route mocks of this context: every page, tab and frame of it. */
|
|
560
598
|
network(): DriverNetwork;
|
|
599
|
+
/** Virtual WebAuthn authenticators: a passkey without a person at a
|
|
600
|
+
* device. Chromium only — elsewhere every call throws DriverError. */
|
|
601
|
+
webAuthn(): DriverWebAuthn;
|
|
602
|
+
/** Grant browser permissions (`notifications`, `geolocation`, …) to the
|
|
603
|
+
* context, for `origin` or every origin. A name the engine does not
|
|
604
|
+
* know throws DriverError, and what was granted before stays granted. */
|
|
605
|
+
grantPermissions(permissions: readonly string[], opts?: {
|
|
606
|
+
origin?: string;
|
|
607
|
+
}): Promise<void>;
|
|
608
|
+
/** Cut the context off the network, or connect it again. */
|
|
609
|
+
setOffline(offline: boolean): Promise<void>;
|
|
561
610
|
/** A running service worker whose URL matches `url` (substring or
|
|
562
611
|
* regex; any when omitted), or the first to start within `timeoutMs`
|
|
563
612
|
* (default: the context's navigation timeout). Throws at once on a
|
|
@@ -628,7 +677,11 @@ interface DriverPage {
|
|
|
628
677
|
press(loc: LocatorValue, key: string, opts?: PressOptions): Promise<void>;
|
|
629
678
|
check(loc: LocatorValue, opts?: CheckOptions): Promise<void>;
|
|
630
679
|
uncheck(loc: LocatorValue, opts?: CheckOptions): Promise<void>;
|
|
631
|
-
|
|
680
|
+
/** Selects by value (a string, `{value}`, or several for a
|
|
681
|
+
* multi-select), by the option's visible label, or by its position. A
|
|
682
|
+
* label or position no option has fails, once the wait is over, with
|
|
683
|
+
* what the element holds. */
|
|
684
|
+
selectOption(loc: LocatorValue, value: SelectOptionValue, opts?: SelectOptions): Promise<void>;
|
|
632
685
|
hover(loc: LocatorValue, opts?: HoverOptions): Promise<void>;
|
|
633
686
|
scrollIntoView(loc: LocatorValue): Promise<void>;
|
|
634
687
|
/** Drag the source element onto the target. */
|
|
@@ -641,6 +694,10 @@ interface DriverPage {
|
|
|
641
694
|
}): Promise<void>;
|
|
642
695
|
/** Focus the locator then dispatch a paste-like input with `text`. */
|
|
643
696
|
clipboardPaste(loc: LocatorValue, text: string): Promise<void>;
|
|
697
|
+
/** The system clipboard's text, read by this page. Grants the context
|
|
698
|
+
* clipboard access first where the engine needs it; an engine that
|
|
699
|
+
* will not let a page read it throws a DriverError, never "". */
|
|
700
|
+
clipboardRead(): Promise<string>;
|
|
644
701
|
count(loc: LocatorValue): Promise<number>;
|
|
645
702
|
textContent(loc: LocatorValue): Promise<string | null>;
|
|
646
703
|
/** `textContent` of every match, in DOM order; `[]` when nothing
|
|
@@ -682,6 +739,9 @@ interface DriverPage {
|
|
|
682
739
|
* `hidden`) or an interaction state (`enabled`/`disabled`). The latter
|
|
683
740
|
* is polled against `isDisabled`, so `aria-disabled` widgets count. */
|
|
684
741
|
waitFor(loc: LocatorValue, opts?: WaitForOptions): Promise<void>;
|
|
742
|
+
/** Every animation of the matched element and its descendants, as the
|
|
743
|
+
* page has them now — finished, paused and infinite ones included. */
|
|
744
|
+
animations(loc: LocatorValue): Promise<AnimationInfo[]>;
|
|
685
745
|
/** How many finite animations of the matched element and its
|
|
686
746
|
* descendants are still running. Infinite ones (spinners) and paused
|
|
687
747
|
* ones are not counted: neither is going to end by itself. */
|
|
@@ -691,6 +751,15 @@ interface DriverPage {
|
|
|
691
751
|
waitForAnimations(loc: LocatorValue, timeoutMs: number): Promise<void>;
|
|
692
752
|
/** A string matches as a substring of the URL, a regex unanchored. */
|
|
693
753
|
waitForUrl(pattern: Matcher, opts?: NavigationOptions): Promise<void>;
|
|
754
|
+
/** The first WebSocket this page opened since its document loaded whose
|
|
755
|
+
* URL matches `glob` (Playwright's glob syntax, see url-glob.ts) — one
|
|
756
|
+
* opened before the call counts. Throws `TimeoutError` naming the mask
|
|
757
|
+
* and the sockets the page did open. */
|
|
758
|
+
waitForWebSocket(glob: string, opts: {
|
|
759
|
+
timeoutMs: number;
|
|
760
|
+
}): Promise<{
|
|
761
|
+
url: string;
|
|
762
|
+
}>;
|
|
694
763
|
/** Change the media features this page reports, from now on: what
|
|
695
764
|
* `matchMedia` and CSS `@media` see. A feature left out keeps its
|
|
696
765
|
* current value. This page only — a tab opened later starts without it. */
|
|
@@ -767,6 +836,26 @@ interface InspectElementOptions {
|
|
|
767
836
|
limit: number;
|
|
768
837
|
};
|
|
769
838
|
}
|
|
839
|
+
/** One animation of an element, as `animations(loc)` reads it. */
|
|
840
|
+
interface AnimationInfo {
|
|
841
|
+
/** `@keyframes` name, the transitioned property, or a script one's `id`. */
|
|
842
|
+
name: string;
|
|
843
|
+
kind: "animation" | "transition" | "script";
|
|
844
|
+
/** `running`, `paused`, `finished` or `idle`. */
|
|
845
|
+
playState: string;
|
|
846
|
+
/** Milliseconds into the animation; null when it has no time. */
|
|
847
|
+
currentTime: number | null;
|
|
848
|
+
/** Repeats forever — a spinner. */
|
|
849
|
+
infinite: boolean;
|
|
850
|
+
}
|
|
851
|
+
/** What `selectOption` picks an `<option>` by. */
|
|
852
|
+
type SelectOptionValue = string | ReadonlyArray<string> | {
|
|
853
|
+
readonly value: string;
|
|
854
|
+
} | {
|
|
855
|
+
readonly label: string;
|
|
856
|
+
} | {
|
|
857
|
+
readonly index: number;
|
|
858
|
+
};
|
|
770
859
|
interface ElementHint {
|
|
771
860
|
/** The wire-only ref the resolver is acting on. Echoed back so the
|
|
772
861
|
* resolver can verify the resolved locator still points at the same
|
|
@@ -886,4 +975,4 @@ interface PageConsole {
|
|
|
886
975
|
errors: readonly PageErrorEntry[];
|
|
887
976
|
}
|
|
888
977
|
|
|
889
|
-
export { type
|
|
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 LaunchOptions as b, type ContextOptions as c, type AttachOptions as d, type ActionTimeout as e, type CheckOptions as f, type ClickOptions as g, type CookieOptions as h, type DriverPage as i, type NavigationOptions as j, type PressOptions as k, type SelectOptions as l, type Viewport as m, type ViewportSize as n, type WaitOptions as o, type WaitState as p, type DriverDownload as q, type LocatorStep as r, appendStep as s, describeLocator as t, isLocatorValue as u, rootedAt as v };
|
|
@@ -19,6 +19,9 @@ interface LintDiagnostic {
|
|
|
19
19
|
/** Absolute path of the file the line is in, when that is not the file
|
|
20
20
|
* being linted or run: a helper of `_helpers/` the run loads with it. */
|
|
21
21
|
file?: string;
|
|
22
|
+
/** Which row of a hint table made it, for a frontend that counts sites
|
|
23
|
+
* per row (`upgrade-hints`): the `id` of a typed-step habit. */
|
|
24
|
+
hint?: string;
|
|
22
25
|
}
|
|
23
26
|
/** What the linter may ask about external variables (bare UPPER_SNAKE
|
|
24
27
|
* identifiers). A predicate, not a list, because the two callers hold
|
|
@@ -32,6 +35,12 @@ interface ExternalVariableLookup {
|
|
|
32
35
|
denial?(name: string): string | undefined;
|
|
33
36
|
/** Where `has` looked, for the diagnostic (`unotest/.env, unotest/.env.dev (no such file)`). */
|
|
34
37
|
describeSources?(): string;
|
|
38
|
+
/** The template (`unotest/.env.example`) that declares NAME while nothing
|
|
39
|
+
* gives it a value. Only a run's lookup answers it: it sees the shell.
|
|
40
|
+
* The `lint` command reads files alone, and a value a CI runner puts in
|
|
41
|
+
* the environment would be invisible to it — so there a template's name
|
|
42
|
+
* simply counts as declared (`has`). */
|
|
43
|
+
declaredOnlyIn?(name: string): string | undefined;
|
|
35
44
|
/** Host policy of the environment this lookup describes (#199) — it
|
|
36
45
|
* answers why NAME must not be used as a HOST in `usage`, or undefined
|
|
37
46
|
* when the use is fine. Absent on a lookup with no project behind it,
|
|
@@ -66,8 +75,18 @@ interface LintOptions {
|
|
|
66
75
|
* file must not count them either, or a silenced call would keep a
|
|
67
76
|
* summary alive — and anchor it on a line the caller then drops. */
|
|
68
77
|
lintOkLines?: ReadonlySet<number>;
|
|
78
|
+
/** The file's comments (`ParsedScenario.comments`): what an author wrote
|
|
79
|
+
* next to a line is read as its reason by `lint:typed-step-available`. */
|
|
80
|
+
comments?: readonly LintComment[];
|
|
69
81
|
}
|
|
70
82
|
/** Lint a parsed file (`ParsedScenario.program`) or any node in one. */
|
|
71
83
|
declare function lintAst(ast: ESTree.Node, opts?: LintOptions): LintDiagnostic[];
|
|
84
|
+
/** Comment shape consumed from `ParsedScenario.comments` (position + text
|
|
85
|
+
* without the markers). */
|
|
86
|
+
interface LintComment {
|
|
87
|
+
line: number;
|
|
88
|
+
col: number;
|
|
89
|
+
text: string;
|
|
90
|
+
}
|
|
72
91
|
|
|
73
92
|
export { type ExternalVariableLookup as E, type LintDiagnostic as L, type LintSeverity as a, type LintOptions as b, lintAst as l };
|