@unotest/web 0.30.0 → 0.32.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-BluheUKs.js';
3
+ import { E as ElementHint } from '../interfaces-B34N4rfI.js';
4
4
  import '../config/schema.js';
5
5
  import 'zod';
6
6
 
@@ -226,6 +226,10 @@ interface ScreenshotOptions {
226
226
  * pins that floor. */
227
227
  type?: "png" | "jpeg" | "webp";
228
228
  }
229
+ /** Encoding options for an element capture — `ScreenshotOptions` minus
230
+ * the page-geometry fields (`fullPage`, `clip`) that have no meaning for a
231
+ * single element. */
232
+ type ElementScreenshotOptions = Pick<ScreenshotOptions, "type" | "quality">;
229
233
  interface CookieOptions {
230
234
  domain?: string;
231
235
  path?: string;
@@ -429,6 +433,10 @@ interface DriverPage {
429
433
  evaluate<T = unknown>(js: string, arg?: unknown): Promise<T>;
430
434
  evaluateOnLocator<T = unknown>(loc: LocatorValue, js: string): Promise<T>;
431
435
  screenshot(opts?: ScreenshotOptions): Promise<Buffer>;
436
+ /** Capture ONE element (first match, scrolled into view) instead of the
437
+ * viewport — the evidence shot of a card / row / dialog. Same encoding
438
+ * options as `screenshot`; `fullPage` / `clip` don't apply. */
439
+ screenshotElement(loc: LocatorValue, opts?: ElementScreenshotOptions): Promise<Buffer>;
432
440
  inspectElement(loc: LocatorValue): Promise<ElementHint | null>;
433
441
  /** outerHTML of the element the locator matches (first match), or null
434
442
  * when it resolves to zero elements. Used by debug logging to persist
@@ -0,0 +1,8 @@
1
+ interface LegacyLayout {
2
+ /** Root-relative config path that is no longer read, if there is one. */
3
+ configPath?: string;
4
+ /** True when the product's own manifest still carries the runner. */
5
+ pinInProductManifest: boolean;
6
+ }
7
+
8
+ export type { LegacyLayout as L };
@@ -0,0 +1,36 @@
1
+ import { BlockStatement } from '@unotest/dsl';
2
+
3
+ type LintSeverity = 'error' | 'warning' | 'info';
4
+ interface LintDiagnostic {
5
+ rule: string;
6
+ severity: LintSeverity;
7
+ message: string;
8
+ line: number;
9
+ col: number;
10
+ }
11
+ /** What the linter may ask about external variables (bare UPPER_SNAKE
12
+ * identifiers). A predicate, not a list, because the two callers hold
13
+ * different truths: `lint` knows the NAMES declared in the project's
14
+ * files, a run knows what the runtime will actually RESOLVE (files plus
15
+ * the ambient shell) — and the run-time store already answers `has`. */
16
+ interface ExternalVariableLookup {
17
+ has(name: string): boolean;
18
+ /** Where `has` looked, for the diagnostic (`unotest/.env, unotest/.env.dev (no such file)`). */
19
+ describeSources?(): string;
20
+ }
21
+ interface LintOptions {
22
+ /** Per-rule severity override. Default severities live with each rule. */
23
+ ruleSeverity?: Partial<Record<string, LintSeverity>>;
24
+ /** Pass through if the agent provided documented justification — e.g. a
25
+ * `// reason:` comment immediately above the line. The lexer doesn't
26
+ * preserve comments today; for v1 we accept a flag from the caller. */
27
+ allowDisambigByIndex?: boolean;
28
+ /** Enables `lint:external-variable-undeclared`: every bare UPPER_SNAKE
29
+ * identifier that is neither bound in this file nor known to the
30
+ * lookup is an error. Absent → the rule is off (the caller has no
31
+ * project to check against, e.g. an ad-hoc source string). */
32
+ externalVariables?: ExternalVariableLookup;
33
+ }
34
+ declare function lintAst(ast: BlockStatement, opts?: LintOptions): LintDiagnostic[];
35
+
36
+ export { type ExternalVariableLookup as E, type LintDiagnostic as L, type LintSeverity as a, type LintOptions as b, lintAst as l };