@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.
- package/.claude/skills/write-e2e-test/SKILL.md +6 -7
- package/.claude/skills/write-e2e-test-ground/SKILL.md +6 -7
- package/CHANGELOG.md +294 -3
- package/README.md +5 -4
- package/bin/unotest-web.js +10 -9
- package/dist/config/schema.d.ts +11 -11
- package/dist/config/schema.js +1 -1
- package/dist/driver/index.d.ts +4 -2
- package/dist/driver/index.js +1 -1
- package/dist/dsl/index.d.ts +43 -28
- package/dist/dsl/index.js +1 -1
- package/dist/dsl/web-dsl-language-service.d.ts +18 -6
- package/dist/dsl/web-dsl-language-service.js +1 -1
- package/dist/inspection/page-inject.d.ts +1 -1
- package/dist/inspection/page-inject.js +15 -9
- package/dist/{interfaces-D5ePwBX6.d.ts → interfaces--zgFOUB6.d.ts} +17 -0
- package/dist/{linter-RrjB1n9R.d.ts → linter-Ci17V2Sr.d.ts} +13 -5
- 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 +15 -1
- package/guides/dsl-reference.md +416 -259
- package/package.json +8 -8
- package/types/unotest-dsl.d.ts +115 -84
- package/types/unotest-lib.d.ts +1289 -0
|
@@ -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 } from '../interfaces--zgFOUB6.js';
|
|
4
4
|
import '../config/schema.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
|
|
@@ -2775,15 +2775,21 @@ function pasteValue(el, pasted) {
|
|
|
2775
2775
|
__name(pasteValue, "pasteValue");
|
|
2776
2776
|
function readCheckedState(el) {
|
|
2777
2777
|
globalThis.__name ??= (fn) => fn;
|
|
2778
|
-
const
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2778
|
+
const own = /* @__PURE__ */ __name((node) => {
|
|
2779
|
+
const input = node;
|
|
2780
|
+
if (input.tagName === "INPUT" && (input.type === "checkbox" || input.type === "radio")) {
|
|
2781
|
+
return input.checked;
|
|
2782
|
+
}
|
|
2783
|
+
const role = node.getAttribute("role");
|
|
2784
|
+
if (role === "checkbox" || role === "radio" || role === "switch") {
|
|
2785
|
+
return node.getAttribute("aria-checked") === "true";
|
|
2786
|
+
}
|
|
2787
|
+
return null;
|
|
2788
|
+
}, "own");
|
|
2789
|
+
const state = own(el);
|
|
2790
|
+
if (state !== null) return state;
|
|
2791
|
+
const control = el.closest("label")?.control;
|
|
2792
|
+
return control ? own(control) : null;
|
|
2787
2793
|
}
|
|
2788
2794
|
__name(readCheckedState, "readCheckedState");
|
|
2789
2795
|
function readDisabledState(el) {
|
|
@@ -9,6 +9,13 @@ type LocatorStep = {
|
|
|
9
9
|
role: string;
|
|
10
10
|
name?: Matcher;
|
|
11
11
|
exact?: boolean;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
includeHidden?: boolean;
|
|
16
|
+
level?: number;
|
|
17
|
+
pressed?: boolean;
|
|
18
|
+
selected?: boolean;
|
|
12
19
|
} | {
|
|
13
20
|
kind: 'getByText';
|
|
14
21
|
text: Matcher;
|
|
@@ -322,6 +329,13 @@ interface WebDriver {
|
|
|
322
329
|
* `finally` blocks).
|
|
323
330
|
*/
|
|
324
331
|
close(): Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* The error a scenario should see for one its call got from the browser
|
|
334
|
+
* library: that library's own classes (Playwright's timeout) as ours, so
|
|
335
|
+
* whether the run failed or errored is decided by a class we own. Any
|
|
336
|
+
* other error is returned as it is.
|
|
337
|
+
*/
|
|
338
|
+
translateError(e: unknown): unknown;
|
|
325
339
|
/**
|
|
326
340
|
* Collaborative debug (Slice 1). `wsEndpoint()` returns the Playwright
|
|
327
341
|
* `connect()` endpoint when launched in share mode (else undefined);
|
|
@@ -629,6 +643,9 @@ interface DriverPage {
|
|
|
629
643
|
clipboardPaste(loc: LocatorValue, text: string): Promise<void>;
|
|
630
644
|
count(loc: LocatorValue): Promise<number>;
|
|
631
645
|
textContent(loc: LocatorValue): Promise<string | null>;
|
|
646
|
+
/** `textContent` of every match, in DOM order; `[]` when nothing
|
|
647
|
+
* matches. One read, no wait — a query, not an assertion. */
|
|
648
|
+
textContents(loc: LocatorValue): Promise<string[]>;
|
|
632
649
|
/** RENDERED text: line breaks preserved, `display:none` subtrees and
|
|
633
650
|
* `<script>`/`<style>` excluded. What a human reads on screen —
|
|
634
651
|
* `textContent` is the raw source-order concatenation and answers a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ESTree } from '@unotest/dsl';
|
|
2
2
|
|
|
3
3
|
type LintSeverity = 'error' | 'warning' | 'info';
|
|
4
4
|
interface LintDiagnostic {
|
|
@@ -10,11 +10,15 @@ interface LintDiagnostic {
|
|
|
10
10
|
/** This diagnostic must stop a run before anything is driven, not just
|
|
11
11
|
* print. A rule sets it when proceeding would act on the WRONG target
|
|
12
12
|
* — the steps before the offending one would run against the wrong
|
|
13
|
-
* host and leave their side effects there. The CLI
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* host and leave their side effects there. The CLI refuses on it at any
|
|
14
|
+
* severity (its pre-run lint otherwise stops on some errors only:
|
|
15
|
+
* `cliPreRunLint`); run_test already gates on errors and is
|
|
16
|
+
* unaffected. Rules opt in themselves, so no frontend
|
|
16
17
|
* keeps a list of rule ids. */
|
|
17
18
|
blocksRun?: true;
|
|
19
|
+
/** Absolute path of the file the line is in, when that is not the file
|
|
20
|
+
* being linted or run: a helper of `_helpers/` the run loads with it. */
|
|
21
|
+
file?: string;
|
|
18
22
|
}
|
|
19
23
|
/** What the linter may ask about external variables (bare UPPER_SNAKE
|
|
20
24
|
* identifiers). A predicate, not a list, because the two callers hold
|
|
@@ -23,6 +27,9 @@ interface LintDiagnostic {
|
|
|
23
27
|
* the ambient shell) — and the run-time store already answers `has`. */
|
|
24
28
|
interface ExternalVariableLookup {
|
|
25
29
|
has(name: string): boolean;
|
|
30
|
+
/** Why NAME is refused although the environment may hold it — the
|
|
31
|
+
* runner's own credential. Absent on a lookup that cannot tell. */
|
|
32
|
+
denial?(name: string): string | undefined;
|
|
26
33
|
/** Where `has` looked, for the diagnostic (`unotest/.env, unotest/.env.dev (no such file)`). */
|
|
27
34
|
describeSources?(): string;
|
|
28
35
|
/** Host policy of the environment this lookup describes (#199) — it
|
|
@@ -60,6 +67,7 @@ interface LintOptions {
|
|
|
60
67
|
* summary alive — and anchor it on a line the caller then drops. */
|
|
61
68
|
lintOkLines?: ReadonlySet<number>;
|
|
62
69
|
}
|
|
63
|
-
|
|
70
|
+
/** Lint a parsed file (`ParsedScenario.program`) or any node in one. */
|
|
71
|
+
declare function lintAst(ast: ESTree.Node, opts?: LintOptions): LintDiagnostic[];
|
|
64
72
|
|
|
65
73
|
export { type ExternalVariableLookup as E, type LintDiagnostic as L, type LintSeverity as a, type LintOptions as b, lintAst as l };
|