@9l/playwright 0.6.0-beta → 0.6.0-beta.2

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/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export declare const test: import("@playwright/test").TestType<import("@playwrig
11
11
  }, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
12
12
  export { expect };
13
13
  export { protocolVersion } from './protocol';
14
- export { createTargetTest, TargetApp, webTargetDriver, targetCapabilities } from './targets';
15
- export type { TargetDriver, TargetHandle, TargetIdentity, TargetContext, TargetState, TargetFixtures, TargetOperationOptions } from './targets';
14
+ export { createTargetTest, TargetApp, webTargetDriver, targetCapabilities, TargetSetupError, validTargetSetup, validTargetDiagnostic } from './targets';
15
+ export type { TargetDriver, TargetHandle, TargetIdentity, TargetContext, TargetState, TargetFixtures, TargetOperationOptions, TargetSetupRecord, SetupClassification, TargetDiagnostic, WindowObservation, TargetPoint, TargetRect, TargetSize, ScrollDirection } from './targets';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.targetCapabilities = exports.webTargetDriver = exports.TargetApp = exports.createTargetTest = exports.protocolVersion = exports.expect = exports.test = void 0;
3
+ exports.validTargetDiagnostic = exports.validTargetSetup = exports.TargetSetupError = exports.targetCapabilities = exports.webTargetDriver = exports.TargetApp = exports.createTargetTest = exports.protocolVersion = exports.expect = exports.test = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_1.expect; } });
6
6
  const protocol_1 = require("./protocol");
@@ -37,3 +37,6 @@ Object.defineProperty(exports, "createTargetTest", { enumerable: true, get: func
37
37
  Object.defineProperty(exports, "TargetApp", { enumerable: true, get: function () { return targets_1.TargetApp; } });
38
38
  Object.defineProperty(exports, "webTargetDriver", { enumerable: true, get: function () { return targets_1.webTargetDriver; } });
39
39
  Object.defineProperty(exports, "targetCapabilities", { enumerable: true, get: function () { return targets_1.targetCapabilities; } });
40
+ Object.defineProperty(exports, "TargetSetupError", { enumerable: true, get: function () { return targets_1.TargetSetupError; } });
41
+ Object.defineProperty(exports, "validTargetSetup", { enumerable: true, get: function () { return targets_1.validTargetSetup; } });
42
+ Object.defineProperty(exports, "validTargetDiagnostic", { enumerable: true, get: function () { return targets_1.validTargetDiagnostic; } });
@@ -1,12 +1,12 @@
1
1
  export declare const protocolVersion = "9l.engine/1";
2
2
  export declare const maxFrameBytes: number;
3
3
  export declare const maxEvents = 10000;
4
- export declare const capabilities: readonly ["steps", "artifact-metadata", "terminal-outcomes"];
5
- export declare const targetVersion = "9l.target/1";
4
+ export declare const capabilities: readonly ["steps", "artifact-metadata", "terminal-outcomes", "declared-outcomes"];
5
+ export declare const targetVersion = "9l.target/2";
6
6
  export declare const targetStepFile: string;
7
7
  export declare function selectedTarget(env?: NodeJS.ProcessEnv): {
8
8
  name: string;
9
- kind: "web" | "android-fake" | "android";
9
+ kind: "android" | "web" | "android-fake";
10
10
  appId: string;
11
11
  id: string;
12
12
  };
package/dist/protocol.js CHANGED
@@ -11,8 +11,8 @@ const node_path_1 = require("node:path");
11
11
  exports.protocolVersion = '9l.engine/1';
12
12
  exports.maxFrameBytes = 16 * 1024;
13
13
  exports.maxEvents = 10000;
14
- exports.capabilities = ['steps', 'artifact-metadata', 'terminal-outcomes'];
15
- exports.targetVersion = '9l.target/1';
14
+ exports.capabilities = ['steps', 'artifact-metadata', 'terminal-outcomes', 'declared-outcomes'];
15
+ exports.targetVersion = '9l.target/2';
16
16
  // Typed target steps carry this module's own location. The reporter counts only
17
17
  // those, so a user step titled "9l target ..." stays an ordinary step. Code in the
18
18
  // worker can still forge one deliberately; the worker remains trusted.
@@ -6,6 +6,7 @@ export default class EngineReporter implements Reporter {
6
6
  private seq;
7
7
  private stepSeq;
8
8
  private suite?;
9
+ private declared;
9
10
  private terminal;
10
11
  private overflow;
11
12
  printsToStdio(): boolean;
package/dist/reporter.js CHANGED
@@ -4,6 +4,7 @@ const node_crypto_1 = require("node:crypto");
4
4
  const node_fs_1 = require("node:fs");
5
5
  const protocol_1 = require("./protocol");
6
6
  const android_runtime_1 = require("./android-runtime");
7
+ const target_setup_1 = require("./target-setup");
7
8
  function insideAssertion(step) {
8
9
  for (let ancestor = step.parent; ancestor; ancestor = ancestor.parent) {
9
10
  if (ancestor.category === 'expect')
@@ -11,6 +12,12 @@ function insideAssertion(step) {
11
12
  }
12
13
  return false;
13
14
  }
15
+ // A typed target step fails only with "9lives target stopped: <reason>", where
16
+ // the reason is the fixture's own token. Only a token of that exact form crosses
17
+ // the bridge; any other error text, or none, sends no reason.
18
+ function targetStopReason(error) {
19
+ return /^(?:Error: )?9lives target stopped: ([a-z_]{1,64})$/.exec(error?.message ?? '')?.[1];
20
+ }
14
21
  // Worker logs, error messages, step titles, URLs and attachment bodies never enter
15
22
  // the protocol. IDs are hashes; Go persists only this bounded metadata stream.
16
23
  class EngineReporter {
@@ -21,6 +28,12 @@ class EngineReporter {
21
28
  seq = 0;
22
29
  stepSeq = 0;
23
30
  suite;
31
+ // The expected status of each test before any attempt ran. Playwright
32
+ // updates test.expectedStatus only when an attempt ends, so a test_begin
33
+ // frame carries the declaration (test.fail('title', ...) or a suite-level
34
+ // modifier) and test_end the final value; Go reads a difference as a
35
+ // modifier that ran during the attempt, in the body or in an after hook.
36
+ declared = new Map();
24
37
  terminal = false;
25
38
  overflow = false;
26
39
  printsToStdio() { return true; }
@@ -43,6 +56,8 @@ class EngineReporter {
43
56
  }
44
57
  onBegin(_config, suite) {
45
58
  this.suite = suite;
59
+ for (const test of suite.allTests())
60
+ this.declared.set(test.id, test.expectedStatus);
46
61
  this.emit('hello', { capabilities: this.target ? [...protocol_1.capabilities, protocol_1.targetVersion] : protocol_1.capabilities, totalTests: suite.allTests().length, ...(this.target ? { targetVersion: protocol_1.targetVersion } : {}) });
47
62
  if (this.target) {
48
63
  for (const test of suite.allTests()) {
@@ -55,7 +70,7 @@ class EngineReporter {
55
70
  }
56
71
  }
57
72
  onTestBegin(test, result) {
58
- this.emit('test_begin', { testId: this.testId(test), retry: result.retry });
73
+ this.emit('test_begin', { testId: this.testId(test), retry: result.retry, expectedStatus: this.declared.get(test.id) ?? test.expectedStatus });
59
74
  }
60
75
  onStepEnd(test, result, step) {
61
76
  // expect.poll, toPass and custom matchers report the assertions they run,
@@ -66,10 +81,12 @@ class EngineReporter {
66
81
  return;
67
82
  const categories = { 'test.step': 'action', expect: 'assertion', 'pw:api': 'browser', fixture: 'fixture' };
68
83
  const operation = this.target && step.category === 'test.step' && step.location?.file === protocol_1.targetStepFile && step.title.startsWith('9l target ') ? step.title.slice('9l target '.length) : undefined;
84
+ const reason = operation && step.error ? targetStopReason(step.error) : undefined;
69
85
  this.emit('step_end', {
70
86
  testId: this.testId(test), retry: result.retry, stepId: `step-${++this.stepSeq}`,
71
87
  category: operation ? operation.startsWith('assert-') ? 'assertion' : 'action' : step.category === 'test.step' && step.title === '9l goal' ? 'goal' : categories[step.category] ?? 'other', status: step.error ? 'failed' : 'passed',
72
88
  ...(operation ? { operation } : {}),
89
+ ...(reason ? { reason } : {}),
73
90
  });
74
91
  }
75
92
  onTestEnd(test, result) {
@@ -77,7 +94,60 @@ class EngineReporter {
77
94
  this.emit('engine_error');
78
95
  return;
79
96
  }
97
+ // Bounded classifications from a native target only: at most one made
98
+ // before the test ran (a recovered baseline) and one from a recheck.
99
+ const setups = result.attachments.filter(attachment => attachment.name === '9l.target-setup');
100
+ const stages = setups.map(attachment => { try {
101
+ return JSON.parse(attachment.body?.toString('utf8') ?? '')?.stage;
102
+ }
103
+ catch {
104
+ return undefined;
105
+ } });
106
+ if (result.attachments.filter(attachment => attachment.name === '9l.target-diagnostic').length > 1 || setups.length > 2 || (setups.length === 2 && !(stages[0] === 'open' && stages[1] === 'recheck'))) {
107
+ this.emit('engine_error');
108
+ return;
109
+ }
80
110
  for (const attachment of result.attachments) {
111
+ if (attachment.name === '9l.target-diagnostic') {
112
+ if (!this.target || this.target.kind === 'web' || attachment.contentType !== target_setup_1.targetDiagnosticType || !attachment.body || attachment.body.length > 1024) {
113
+ this.emit('engine_error');
114
+ return;
115
+ }
116
+ let diagnostic;
117
+ try {
118
+ diagnostic = JSON.parse(attachment.body.toString('utf8'));
119
+ }
120
+ catch {
121
+ this.emit('engine_error');
122
+ return;
123
+ }
124
+ if (!(0, target_setup_1.validTargetDiagnostic)(diagnostic)) {
125
+ this.emit('engine_error');
126
+ return;
127
+ }
128
+ this.emit('target_diagnostic', { testId: this.testId(test), retry: result.retry, diagnostic });
129
+ continue;
130
+ }
131
+ if (attachment.name === '9l.target-setup') {
132
+ if (!this.target || this.target.kind === 'web' || attachment.contentType !== target_setup_1.targetSetupType || !attachment.body || attachment.body.length > 512) {
133
+ this.emit('engine_error');
134
+ return;
135
+ }
136
+ let setup;
137
+ try {
138
+ setup = JSON.parse(attachment.body.toString('utf8'));
139
+ }
140
+ catch {
141
+ this.emit('engine_error');
142
+ return;
143
+ }
144
+ if (!(0, target_setup_1.validTargetSetup)(setup)) {
145
+ this.emit('engine_error');
146
+ return;
147
+ }
148
+ this.emit('target_setup', { testId: this.testId(test), retry: result.retry, setup });
149
+ continue;
150
+ }
81
151
  if (attachment.name !== '9l.android-runtime')
82
152
  continue;
83
153
  if (this.target?.kind !== 'android' || attachment.contentType !== android_runtime_1.androidRuntimeType || !attachment.body || attachment.body.length > 2048) {
@@ -0,0 +1,50 @@
1
+ export declare const targetSetupType = "application/vnd.9l.target-setup+json";
2
+ export declare const setupClassifications: readonly ["blocked", "dirty", "mismatch", "observer", "unknown"];
3
+ export type SetupClassification = typeof setupClassifications[number];
4
+ /** Reasons per classification; Go rejects any other pair. */
5
+ export declare const setupReasons: Record<SetupClassification, readonly string[]>;
6
+ export type TargetSetupRecord = {
7
+ classification: SetupClassification;
8
+ reason: string;
9
+ /** `open`: found before any application operation; `recheck`: found after a failed assertion. */
10
+ stage: 'open' | 'recheck';
11
+ /** A user-declared, non-destructive recovery the driver took before the test ran. */
12
+ recovery?: {
13
+ method: 'back';
14
+ presses: number;
15
+ restored: boolean;
16
+ };
17
+ };
18
+ export declare function validTargetSetup(value: unknown): value is TargetSetupRecord;
19
+ /** Thrown by a driver's open (or returned by its recheck) to classify the
20
+ * device or app state instead of letting the failure read as an application
21
+ * defect. The session stops with reason `setup_<classification>`. */
22
+ export declare class TargetSetupError extends Error {
23
+ readonly record: TargetSetupRecord;
24
+ constructor(record: TargetSetupRecord, cause?: unknown);
25
+ }
26
+ /** Opt-in, metadata-only description of a failed target operation: timing,
27
+ * requested coordinates, viewport and the app's window count/focus at the
28
+ * last mutation and after the failure. It states what was observed, never a
29
+ * cause, and carries no screen content, hierarchy, text or identifiers. */
30
+ export declare const targetDiagnosticType = "application/vnd.9l.target-diagnostic+json";
31
+ export type WindowObservation = {
32
+ windows: number;
33
+ focus: 'app' | 'foreign' | 'none' | 'unknown';
34
+ };
35
+ export type TargetDiagnostic = {
36
+ operation: string;
37
+ reason: string;
38
+ elapsedMs: number;
39
+ x?: number;
40
+ y?: number;
41
+ point?: true;
42
+ viewportWidth?: number;
43
+ viewportHeight?: number;
44
+ /** -1: not observed. */
45
+ windowsBefore: number;
46
+ windowsAfter: number;
47
+ focusBefore?: WindowObservation['focus'];
48
+ focusAfter?: WindowObservation['focus'];
49
+ };
50
+ export declare function validTargetDiagnostic(value: unknown): value is TargetDiagnostic;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.targetDiagnosticType = exports.TargetSetupError = exports.setupReasons = exports.setupClassifications = exports.targetSetupType = void 0;
4
+ exports.validTargetSetup = validTargetSetup;
5
+ exports.validTargetDiagnostic = validTargetDiagnostic;
6
+ // A native driver's bounded classification of the device or app state. It
7
+ // crosses the worker bridge as closed metadata; no screen content, window
8
+ // titles, hierarchy or device identifiers are part of it.
9
+ exports.targetSetupType = 'application/vnd.9l.target-setup+json';
10
+ exports.setupClassifications = ['blocked', 'dirty', 'mismatch', 'observer', 'unknown'];
11
+ /** Reasons per classification; Go rejects any other pair. */
12
+ exports.setupReasons = {
13
+ blocked: ['device-locked', 'screen-off'],
14
+ dirty: ['extra-window', 'foreign-focus', 'ime-showing'],
15
+ /** The device is not in the posture or width the spec declared. */
16
+ mismatch: ['posture', 'display-width', 'build-digest', 'build-version', 'build-signer'],
17
+ /** The accessibility snapshot still reported an element whose window the
18
+ * window manager no longer lists: observer staleness, not the app. */
19
+ observer: ['window-gone-element-displayed'],
20
+ unknown: ['device-state-unknown'],
21
+ };
22
+ function validTargetSetup(value) {
23
+ if (!value || typeof value !== 'object' || Array.isArray(value))
24
+ return false;
25
+ const r = value;
26
+ const keys = Object.keys(r);
27
+ if (keys.some(key => !['classification', 'reason', 'stage', 'recovery'].includes(key)) || keys.length < 3)
28
+ return false;
29
+ if (!exports.setupClassifications.includes(r.classification) || typeof r.reason !== 'string' ||
30
+ !exports.setupReasons[r.classification].includes(r.reason) || !['open', 'recheck'].includes(r.stage))
31
+ return false;
32
+ if (r.classification === 'observer' && r.stage !== 'recheck')
33
+ return false;
34
+ if (r.recovery === undefined)
35
+ return true;
36
+ const recovery = r.recovery;
37
+ return !!recovery && typeof recovery === 'object' && !Array.isArray(recovery) && Object.keys(recovery).length === 3 &&
38
+ recovery.method === 'back' && Number.isInteger(recovery.presses) && recovery.presses >= 0 && recovery.presses <= 16 &&
39
+ typeof recovery.restored === 'boolean' && r.classification === 'dirty' && r.stage === 'open';
40
+ }
41
+ /** Thrown by a driver's open (or returned by its recheck) to classify the
42
+ * device or app state instead of letting the failure read as an application
43
+ * defect. The session stops with reason `setup_<classification>`. */
44
+ class TargetSetupError extends Error {
45
+ record;
46
+ constructor(record, cause) {
47
+ super(`9lives target setup ${record.classification}: ${record.reason}`, cause === undefined ? undefined : { cause });
48
+ this.record = record;
49
+ if (!validTargetSetup(record))
50
+ throw new Error('9lives target setup: invalid record');
51
+ }
52
+ }
53
+ exports.TargetSetupError = TargetSetupError;
54
+ /** Opt-in, metadata-only description of a failed target operation: timing,
55
+ * requested coordinates, viewport and the app's window count/focus at the
56
+ * last mutation and after the failure. It states what was observed, never a
57
+ * cause, and carries no screen content, hierarchy, text or identifiers. */
58
+ exports.targetDiagnosticType = 'application/vnd.9l.target-diagnostic+json';
59
+ function validTargetDiagnostic(value) {
60
+ if (!value || typeof value !== 'object' || Array.isArray(value))
61
+ return false;
62
+ const d = value;
63
+ const pixel = (v) => Number.isInteger(v) && v >= 0 && v <= 65_535;
64
+ const windows = (v) => Number.isInteger(v) && v >= -1 && v <= 1024;
65
+ const focus = (v) => v === undefined || ['app', 'foreign', 'none', 'unknown'].includes(v);
66
+ if (Object.keys(d).some(key => !['operation', 'reason', 'elapsedMs', 'x', 'y', 'point', 'viewportWidth', 'viewportHeight', 'windowsBefore', 'windowsAfter', 'focusBefore', 'focusAfter'].includes(key)))
67
+ return false;
68
+ return typeof d.operation === 'string' && /^[a-z-]{1,32}$/.test(d.operation) && typeof d.reason === 'string' && /^[a-z_]{1,64}$/.test(d.reason) &&
69
+ Number.isInteger(d.elapsedMs) && d.elapsedMs >= 0 && d.elapsedMs <= 3_600_000 &&
70
+ (d.point === undefined ? d.x === undefined && d.y === undefined : d.point === true && pixel(d.x) && pixel(d.y)) &&
71
+ (d.viewportWidth === undefined ? d.viewportHeight === undefined : pixel(d.viewportWidth) && pixel(d.viewportHeight) && d.viewportWidth > 0 && d.viewportHeight > 0) &&
72
+ windows(d.windowsBefore) && windows(d.windowsAfter) && focus(d.focusBefore) && focus(d.focusAfter);
73
+ }
package/dist/targets.d.ts CHANGED
@@ -1,7 +1,23 @@
1
1
  import { type Page } from '@playwright/test';
2
2
  import { targetVersion } from './protocol';
3
3
  import { type AndroidRuntime } from './android-runtime';
4
- export declare const targetCapabilities: readonly ["open", "reset", "test-id", "tap", "fill", "visible", "text", "state"];
4
+ import { type TargetSetupRecord, type TargetDiagnostic } from './target-setup';
5
+ export { TargetSetupError, validTargetSetup, validTargetDiagnostic, type TargetSetupRecord, type SetupClassification, type TargetDiagnostic, type WindowObservation } from './target-setup';
6
+ export declare const targetCapabilities: readonly ["open", "reset", "test-id", "tap", "fill", "visible", "text", "state", "back", "keyboard", "scroll", "tap-at", "bounds", "viewport", "terminate", "activate", "screen-digest"];
7
+ export type ScrollDirection = 'up' | 'down' | 'left' | 'right';
8
+ /** Integer device coordinates: physical pixels on Android, CSS pixels in the web viewport. */
9
+ export type TargetPoint = {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ export type TargetRect = TargetPoint & {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ export type TargetSize = {
18
+ width: number;
19
+ height: number;
20
+ };
5
21
  export type TargetIdentity = {
6
22
  kind: 'web' | 'android-fake' | 'android';
7
23
  appId: string;
@@ -24,6 +40,9 @@ export interface TargetHandle {
24
40
  visible(context: TargetContext): Promise<boolean>;
25
41
  text(context: TargetContext): Promise<string>;
26
42
  state(name: TargetState, context: TargetContext): Promise<boolean>;
43
+ /** One bounded scroll gesture inside this element; percent of its size. */
44
+ scroll?(direction: ScrollDirection, percent: number, context: TargetContext): Promise<void>;
45
+ bounds?(context: TargetContext): Promise<TargetRect>;
27
46
  }
28
47
  export interface TargetDriver extends TargetIdentity {
29
48
  version: typeof targetVersion;
@@ -32,8 +51,41 @@ export interface TargetDriver extends TargetIdentity {
32
51
  reset(context: TargetContext): Promise<void>;
33
52
  /** Observe at most two matches; two means ambiguous and must fail. */
34
53
  observeTestId(id: string, context: TargetContext): Promise<readonly TargetHandle[]>;
54
+ /** Platform back: Android's Back key, the browser's history. */
55
+ back?(context: TargetContext): Promise<void>;
56
+ /** Software keyboard visibility; an unreadable state throws. Android only. */
57
+ keyboardShown?(context: TargetContext): Promise<boolean>;
58
+ /** Dismiss the keyboard without changing the input method. Android only. */
59
+ hideKeyboard?(context: TargetContext): Promise<void>;
60
+ /** One touch down/up at device coordinates. */
61
+ tapAt?(point: TargetPoint, context: TargetContext): Promise<void>;
62
+ viewport?(context: TargetContext): Promise<TargetSize>;
63
+ /** SHA-256 of a screenshot of the target display, computed in memory. The
64
+ * image itself is never returned, written or attached. */
65
+ screenDigest?(context: TargetContext): Promise<string>;
66
+ /** Stop and relaunch the configured app, keeping its data. Android only. */
67
+ terminate?(context: TargetContext): Promise<void>;
68
+ activate?(context: TargetContext): Promise<void>;
35
69
  close(): Promise<void>;
36
70
  runtime?(): AndroidRuntime | undefined;
71
+ /** After a successful open: the setup record of a declared recovery that
72
+ * restored the baseline, so the receipt shows the test ran from it. */
73
+ setup?(): TargetSetupRecord | undefined;
74
+ /** After a completed assertion failure, while the driver is still open:
75
+ * classify the device state (a locked phone, for example) so the failure
76
+ * reads as inconclusive setup, never as an application defect. It must only
77
+ * read state; it never acts on the device. Its own errors are ignored. */
78
+ recheck?(context: TargetContext, failed: {
79
+ operation: string;
80
+ }): Promise<TargetSetupRecord | undefined>;
81
+ /** Opt-in: describe a failed operation as bounded metadata, captured before
82
+ * fixture teardown. Read-only; errors are ignored; one record per test. */
83
+ diagnose?(failure: {
84
+ operation: string;
85
+ reason: string;
86
+ elapsedMs: number;
87
+ point?: TargetPoint;
88
+ }, context: TargetContext): Promise<TargetDiagnostic | undefined>;
37
89
  }
38
90
  /** Deterministic shared operations; browser/device handles stay in the worker. */
39
91
  export declare class TargetApp {
@@ -44,6 +96,7 @@ export declare class TargetApp {
44
96
  private busy;
45
97
  private reason;
46
98
  private closing?;
99
+ private diagnosed;
47
100
  private externalAbort;
48
101
  constructor(driver: TargetDriver, expected: TargetIdentity, options: {
49
102
  deadlineMs: number;
@@ -58,13 +111,56 @@ export declare class TargetApp {
58
111
  close(): Promise<void>;
59
112
  /** Permanently stop this session, including a pending mutation. */
60
113
  cancel(): void;
114
+ /** Opt-in failure diagnostics: ask the driver once per test, while it is
115
+ * still open, and attach only a validated record. Never changes the outcome. */
116
+ private diagnose;
61
117
  private perform;
62
118
  open(options?: TargetOperationOptions): Promise<void>;
63
119
  reset(options?: TargetOperationOptions): Promise<void>;
120
+ /** Poll a check to its bound. A completed false observation is an assertion
121
+ * failure even if a later read stalls; a bound reached before any completed
122
+ * check is a deadline; failed reads alone keep their own operation error.
123
+ * After a completed failure, the driver may reclassify the device state. */
124
+ private assertLoop;
125
+ private optional;
126
+ /** Platform back: Android's Back key, the browser's history. */
127
+ back(options?: TargetOperationOptions): Promise<void>;
128
+ /** Dismiss the software keyboard, keeping the selected input method. Android only. */
129
+ hideKeyboard(options?: TargetOperationOptions): Promise<void>;
130
+ /** Android only: assert the software keyboard is shown or hidden. */
131
+ toHaveKeyboard(visible: boolean, timeoutMs?: number): Promise<void>;
132
+ /** One touch down/up at device coordinates, for example outside a pane.
133
+ * Coordinates are integers inside the viewport, checked against the
134
+ * driver's viewport when it reports one; nothing is retried. */
135
+ tapAt(point: TargetPoint, options?: TargetOperationOptions): Promise<void>;
136
+ viewport(options?: TargetOperationOptions): Promise<{
137
+ width: number;
138
+ height: number;
139
+ }>;
140
+ /** A digest of the active display's current image, for settling checks
141
+ * (two equal digests mean nothing moved). The image is never retained. */
142
+ screenDigest(options?: TargetOperationOptions): Promise<string>;
143
+ /** Stop the configured app without clearing its data. Android only. */
144
+ terminate(options?: TargetOperationOptions): Promise<void>;
145
+ /** Bring the configured app back to the foreground. Android only. */
146
+ activate(options?: TargetOperationOptions): Promise<void>;
64
147
  getByTestId(id: string): {
65
148
  tap: (options?: TargetOperationOptions) => Promise<any>;
66
149
  fill: (value: string, options?: TargetOperationOptions) => Promise<void>;
150
+ /** One bounded scroll gesture inside this control, by a fraction of its size. */
151
+ scroll: (direction: ScrollDirection, options?: TargetOperationOptions & {
152
+ percent?: number;
153
+ }) => Promise<void>;
154
+ /** The control's rectangle in device coordinates. */
155
+ bounds: (options?: TargetOperationOptions) => Promise<{
156
+ x: number;
157
+ y: number;
158
+ width: number;
159
+ height: number;
160
+ }>;
67
161
  toBeVisible: (timeoutMs?: number) => Promise<void>;
162
+ /** Passes when the control is absent or not displayed. */
163
+ toBeHidden: (timeoutMs?: number) => Promise<void>;
68
164
  toHaveText: (value: string, timeoutMs?: number) => Promise<void>;
69
165
  toHaveState: (name: TargetState, value: boolean, timeoutMs?: number) => Promise<void>;
70
166
  };
@@ -86,4 +182,3 @@ type TargetOptions = {
86
182
  * context or browser dependency, including when the default config uses them.
87
183
  * Specs load without 9l (listing, editors); using `app` requires 9l run --sdk --target. */
88
184
  export declare function createTargetTest(options: TargetOptions): import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & TargetFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
89
- export {};