@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.
@@ -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-D5ePwBX6.js';
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 input = el;
2779
- if (input.tagName === "INPUT" && (input.type === "checkbox" || input.type === "radio")) {
2780
- return input.checked;
2781
- }
2782
- const role = el.getAttribute("role");
2783
- if (role === "checkbox" || role === "radio" || role === "switch") {
2784
- return el.getAttribute("aria-checked") === "true";
2785
- }
2786
- return null;
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 { BlockStatement } from '@unotest/dsl';
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 (whose pre-run lint
14
- * is otherwise advisory) refuses on it; run_test already gates on
15
- * errors and is unaffected. Rules opt in themselves, so no frontend
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
- declare function lintAst(ast: BlockStatement, opts?: LintOptions): LintDiagnostic[];
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 };