testsurfer 0.1.1 → 0.2.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/README.md CHANGED
@@ -32,6 +32,26 @@ vibesurfer is a daemon that owns one real WebKit engine and speaks a line protoc
32
32
 
33
33
  The daemon is fetched automatically. If `vs` is not on your PATH, testsurfer runs `npx vibesurfer@0.2.14` (pinned, checksum-verified) to download and start it. Set `TESTSURFER_VS` to point at a specific binary. testsurfer reads the daemon's protocol version and feature flags at launch and uses what it offers, so a newer `vs` on your PATH works too.
34
34
 
35
+ ## CI
36
+
37
+ testsurfer runs on macOS and Linux GitHub runners. On Linux it needs WebKitGTK 6 and an X display; the action in this repo installs both and starts the pinned vibesurfer daemon:
38
+
39
+ ```yaml
40
+ jobs:
41
+ test:
42
+ runs-on: ubuntu-24.04 # or macos-15
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ - uses: actions/setup-node@v4
46
+ with:
47
+ node-version: 24
48
+ - run: npm ci
49
+ - uses: frane/testsurfer@v0
50
+ - run: node --test tests/
51
+ ```
52
+
53
+ `vibesurfer-version` overrides the pinned daemon. This repo's own CI runs the same action on both runners. Windows (WebView2) is supported by vibesurfer but not yet tested here.
54
+
35
55
  ## API
36
56
 
37
57
  Locators resolve lazily at action time, against a fresh view:
@@ -39,9 +59,17 @@ Locators resolve lazily at action time, against a fresh view:
39
59
  - `page.getByRole(role, { name, exact, level })` matches ARIA roles (`button`, `textbox`, `heading`, `link`, ...). Name matching is whole-string and case-insensitive by default; `exact: true` makes it case-sensitive. RegExp names are supported.
40
60
  - `page.getByText(text, { exact })` matches visible text, substring and case-insensitive by default.
41
61
  - `page.getByLabel(text, { exact })` matches form fields by their `<label>` (for, wrapping, or `aria-labelledby`) or `aria-label`.
42
- - `.first()` and `.nth(i)` pick one match when several qualify. Otherwise a locator that matches more than one element fails the action, like Playwright's strict mode.
62
+ - `page.getByTestId(id)` matches `data-testid` exactly (string or RegExp). The `testIdAttribute` option changes the attribute.
63
+ - `page.getByPlaceholder(text)`, `page.getByAltText(text)` and `page.getByTitle(text)` match those attributes, substring and case-insensitive by default, whole-string with `{ exact: true }`.
64
+ - `page.locator(css)` takes a CSS selector.
65
+ - Every `getBy*` and `locator()` also exists on a locator and searches inside its matches: `page.getByTestId('cart').getByRole('button', { name: 'Remove' })`.
66
+ - `.filter({ hasText, hasNotText, has, hasNot, visible })` narrows matches; `has` and `hasNot` take a locator searched inside each match.
67
+ - `.and(locator)` keeps elements matching both, `.or(locator)` takes either.
68
+ - `.first()`, `.last()` and `.nth(i)` pick one match when several qualify, and `all()` returns one locator per match. Otherwise a locator that matches more than one element fails the action, like Playwright's strict mode.
43
69
 
44
- Actions auto-wait for their element and retry when the page changes underneath them: `click()`, `fill(value)`, `type(text)` (trusted native keystrokes, for rich-text editors), `press(key)`, `hover()`, `focus()`, `check()`, `uncheck()`, `dragTo(locator)`. Reads: `textContent()`, `inputValue()`, `isChecked()`, `isVisible()`, `boundingBox()`, `count()`, `ariaSnapshot()`.
70
+ Role, text and label queries match the accessibility tree. CSS and attribute queries run in the page and map each element to its node in that tree. An element the tree does not report resolves to the first reported element inside it, or to its nearest reported ancestor when there is none: a `<span>` whose text the tree folded into its list item acts as that item, so `toHaveText` sees the item's text.
71
+
72
+ Actions auto-wait for their element and retry when the page changes underneath them: `click()`, `fill(value)`, `type(text)` (trusted native keystrokes, for rich-text editors), `press(key)`, `hover()`, `focus()`, `check()`, `uncheck()`, `dragTo(locator)`. Reads: `textContent()`, `innerText()`, `inputValue()`, `getAttribute(name)`, `isChecked()`, `isVisible()`, `isHidden()`, `isEnabled()`, `isDisabled()`, `isEditable()`, `isFocused()`, `boundingBox()`, `count()`, `all()`, `ariaSnapshot()`.
45
73
 
46
74
  Clicks and keystrokes dispatch as native OS input. The cadence is configurable per browser: the default `inputMode: 'robotic'` is instant, which is what tests want; `'human'` moves the cursor along a humanized path with realistic timing for flows that score input behavior.
47
75
 
@@ -50,7 +78,9 @@ Assertions poll until they pass or time out:
50
78
  - `expect(locator).toBeVisible()` / `.toBeHidden()`
51
79
  - `expect(locator).toHaveText(value)` / `.toContainText(value)` (string or RegExp)
52
80
  - `expect(locator).toHaveValue(value)` / `.toBeChecked()`
53
- - `expect(locator).toHaveCount(n)`
81
+ - `expect(locator).toBeEnabled()` / `.toBeDisabled()` (native `disabled`, a disabled fieldset, or `aria-disabled="true"`) / `.toBeEditable()` / `.toBeFocused()`
82
+ - `expect(locator).toHaveAttribute(name, value?)` / `.toHaveClass(value)` / `.toHaveId(value)`
83
+ - `expect(locator).toHaveCount(n)` / `.toBeAttached()`
54
84
  - `expect(locator).toMatchAriaSnapshot(template)` / `expect(page).toMatchAriaSnapshot(template)`
55
85
  - `expect(page).toHaveTitle(value)` / `.toHaveURL(value)`
56
86
  - every matcher takes `{ timeout }` and negates with `.not`
@@ -97,13 +127,25 @@ With the `auth` option, every test's `page` starts logged in.
97
127
 
98
128
  The `test` export wraps node:test. Each test gets a fresh `page`; one browser session is shared across the file. `test.describe(name, fn)` groups tests, `test.beforeEach(fn)` and `test.afterEach(fn)` receive the same `{ page }`, and `test.only` / `test.skip` work as in node:test.
99
129
 
100
- `configure(options)` sets the shared browser up before the first test runs:
130
+ Options come from `testsurfer.config.ts` (or `.mts`, `.js`, `.mjs`) in the directory you run the tests from, and from `configure(options)` in a test file, which wins over the file:
131
+
132
+ ```ts
133
+ // testsurfer.config.ts
134
+ import { defineConfig } from 'testsurfer';
135
+
136
+ export default defineConfig({ baseURL: 'http://localhost:3000', screenshot: 'only-on-failure' });
137
+ ```
138
+
139
+ The options:
101
140
 
102
141
  - `baseURL`: resolve relative `goto` URLs against it.
103
142
  - `auth: { name, url }`: start every page logged in (see above).
104
143
  - `screenshot: 'only-on-failure'` with `outputDir` (default `test-results`): save a PNG when a test fails and add its path to the error.
105
144
  - `timeouts: { action, expect, navigation }`, in milliseconds.
106
145
  - `inputMode`: `robotic` (default, instant), `careful`, or `human` (a humanized cursor path for flows that score input behavior).
146
+ - `testIdAttribute`: the attribute `getByTestId` reads, default `data-testid`.
147
+
148
+ Test files run in parallel: `node --test` gives each file its own process (one less than the CPU count at a time; set it with `--test-concurrency=N`), and each process opens its own session on the shared daemon. Tests inside a file run one after another.
107
149
 
108
150
  ```ts
109
151
  import { test, expect, configure } from 'testsurfer';
@@ -139,9 +181,11 @@ await browser.close();
139
181
 
140
182
  Version 0.1 pins vibesurfer 0.2.14 and speaks its frozen wire protocol (v1). Older daemons work for everything except `level`, `checked` and `<label>` lookups, which need the tree attributes 0.2.12 added. Known issue: on some macOS 27 machines each WebKit navigation stalls for about ten seconds inside the engine, which makes suites much slower than the benchmark below; it is tracked in the vibesurfer repo.
141
183
 
184
+ Not supported yet, so a suite that relies on these will not run unchanged: request mocking (`page.route`), frames (`frameLocator`), CSS that pierces shadow roots, `toHaveScreenshot`, page events (`page.on`), multiple pages or contexts per test, parallel tests inside one file, and Windows runners.
185
+
142
186
  ## Benchmark
143
187
 
144
- [`bench/`](bench) runs identical flows through testsurfer and Playwright (WebKit and Chromium) against the same app and reports the numbers, favorable and not. On a GitHub macOS runner with vibesurfer 0.2.13: testsurfer launches in 4ms against Playwright's 0.6-2s, and runs the four-flow suite in 1437ms against 845ms for Playwright-WebKit and 494ms for Playwright-Chromium. A working install is ~6MB against ~300MB+ per Playwright browser. The full table, methodology and history are in the bench README; the `bench` workflow reproduces them.
188
+ [`bench/`](bench) runs identical flows through testsurfer and Playwright (WebKit and Chromium) against the same app and reports the numbers, favorable and not. On GitHub runners with vibesurfer 0.2.14, testsurfer launches in 3-11ms against Playwright's 0.4-1.3s. The four-flow suite takes 702-968ms on macOS against 561-627ms for Playwright-WebKit and 416-483ms for Playwright-Chromium, and 842-873ms on Linux against 549-664ms and 368-408ms. A working install is ~6MB against ~300MB+ per Playwright browser. The full tables, methodology and history are in the bench README; the `bench` workflow reproduces them.
145
189
 
146
190
  ## Example
147
191
 
package/dist/browser.d.ts CHANGED
@@ -20,6 +20,8 @@ export interface LaunchOptions extends ClientOptions {
20
20
  protocol?: ProtocolOptions;
21
21
  /** Resolve relative goto() URLs against this, e.g. `http://localhost:3000`. */
22
22
  baseURL?: string;
23
+ /** Attribute getByTestId matches. Default `data-testid`. */
24
+ testIdAttribute?: string;
23
25
  }
24
26
  export declare class Browser {
25
27
  private readonly client;
@@ -29,6 +31,7 @@ export declare class Browser {
29
31
  private readonly clickVia;
30
32
  private readonly protocol;
31
33
  private readonly baseURL;
34
+ private testIdAttribute;
32
35
  private constructor();
33
36
  /**
34
37
  * Connect to the daemon (spawning it if needed) and open a session.
package/dist/browser.js CHANGED
@@ -38,6 +38,7 @@ export class Browser {
38
38
  clickVia;
39
39
  protocol;
40
40
  baseURL;
41
+ testIdAttribute = 'data-testid';
41
42
  constructor(client, sessionId, timeouts, inputMode, clickVia, protocol, baseURL) {
42
43
  this.baseURL = baseURL;
43
44
  this.client = client;
@@ -66,14 +67,19 @@ export class Browser {
66
67
  client.close();
67
68
  throw new Error('vs_session_open returned no session id');
68
69
  }
69
- return new Browser(client, sessionId, { ...DEFAULT_TIMEOUTS, ...options.timeouts }, options.inputMode ?? 'robotic', options.clickVia ?? (caps.flags.has('clickVia') ? 'act' : 'click-at'), {
70
+ const browser = new Browser(client, sessionId, { ...DEFAULT_TIMEOUTS, ...options.timeouts }, options.inputMode ?? 'robotic', options.clickVia ?? (caps.flags.has('clickVia') ? 'act' : 'click-at'), {
70
71
  actDeltas: options.protocol?.actDeltas ?? caps.flags.has('actDeltas'),
71
72
  navInPlace: options.protocol?.navInPlace ?? caps.proto >= 1,
72
73
  }, options.baseURL);
74
+ if (options.testIdAttribute)
75
+ browser.testIdAttribute = options.testIdAttribute;
76
+ return browser;
73
77
  }
74
78
  /** A new page in this session. Call page.goto(url) to load a URL. */
75
79
  newPage() {
76
- return new Page(this.client, this.sessionId, this.timeouts, this.inputMode, this.clickVia, this.protocol, this.baseURL);
80
+ const page = new Page(this.client, this.sessionId, this.timeouts, this.inputMode, this.clickVia, this.protocol, this.baseURL);
81
+ page.testIdAttribute = this.testIdAttribute;
82
+ return page;
77
83
  }
78
84
  /** Close the session and drop the connection. */
79
85
  async close() {
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAE7D,oEAAoE;AACpE,KAAK,UAAU,SAAS,CAAC,MAAkB;IACzC,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,EAAU,EAAE,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC;gBAAE,SAAS;YACtB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAClC,IAAI,GAAG,KAAK,OAAO;gBAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACrD,IAAI,GAAG,KAAK,OAAO;gBAAE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,C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,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
package/dist/expect.d.ts CHANGED
@@ -35,6 +35,30 @@ export declare class LocatorAssertions {
35
35
  * current tree in it, ready to paste and trim.
36
36
  */
37
37
  toMatchAriaSnapshot(template: string, options?: ExpectOptions): Promise<void>;
38
+ private boolAssertion;
39
+ /** Not disabled (natively or with aria-disabled). */
40
+ toBeEnabled(options?: ExpectOptions): Promise<void>;
41
+ /** Disabled natively (`disabled`, a disabled fieldset) or with `aria-disabled="true"`. */
42
+ toBeDisabled(options?: ExpectOptions): Promise<void>;
43
+ /** An enabled, writable text control or contenteditable element. */
44
+ toBeEditable(options?: ExpectOptions): Promise<void>;
45
+ /** The element has focus. */
46
+ toBeFocused(options?: ExpectOptions): Promise<void>;
47
+ /** At least one match in the page, visible or not. */
48
+ toBeAttached(options?: ExpectOptions): Promise<void>;
49
+ /**
50
+ * The attribute is present, and with `value`, equals it (or matches
51
+ * the RegExp).
52
+ */
53
+ toHaveAttribute(name: string, value?: string | RegExp, options?: ExpectOptions): Promise<void>;
54
+ /**
55
+ * The class attribute equals the string (or matches the RegExp).
56
+ * Like Playwright, a string must be the whole value; use a RegExp to
57
+ * check for one class among several.
58
+ */
59
+ toHaveClass(expected: string | RegExp, options?: ExpectOptions): Promise<void>;
60
+ /** The id attribute equals the string (or matches the RegExp). */
61
+ toHaveId(expected: string | RegExp, options?: ExpectOptions): Promise<void>;
38
62
  /** Exactly `count` matches. */
39
63
  toHaveCount(count: number, options?: ExpectOptions): Promise<void>;
40
64
  }
package/dist/expect.js CHANGED
@@ -138,6 +138,61 @@ export class LocatorAssertions {
138
138
  };
139
139
  }, (actual) => this.msg(`match the aria snapshot\n${template.trim()}\n`, actual));
140
140
  }
141
+ async boolAssertion(condition, read, options) {
142
+ await poll(this.budget(options), this.negated, async () => {
143
+ const v = await read();
144
+ return { pass: v, actual: v ? `it was ${condition}` : `it was not ${condition}` };
145
+ }, (actual) => this.msg(`be ${condition}`, actual));
146
+ }
147
+ /** Not disabled (natively or with aria-disabled). */
148
+ async toBeEnabled(options) {
149
+ await this.boolAssertion('enabled', () => this.locator.isEnabled({ timeout: 1_000 }), options);
150
+ }
151
+ /** Disabled natively (`disabled`, a disabled fieldset) or with `aria-disabled="true"`. */
152
+ async toBeDisabled(options) {
153
+ await this.boolAssertion('disabled', () => this.locator.isDisabled({ timeout: 1_000 }), options);
154
+ }
155
+ /** An enabled, writable text control or contenteditable element. */
156
+ async toBeEditable(options) {
157
+ await this.boolAssertion('editable', () => this.locator.isEditable({ timeout: 1_000 }), options);
158
+ }
159
+ /** The element has focus. */
160
+ async toBeFocused(options) {
161
+ await this.boolAssertion('focused', () => this.locator.isFocused({ timeout: 1_000 }), options);
162
+ }
163
+ /** At least one match in the page, visible or not. */
164
+ async toBeAttached(options) {
165
+ await this.boolAssertion('attached', async () => (await this.locator.count()) > 0, options);
166
+ }
167
+ /**
168
+ * The attribute is present, and with `value`, equals it (or matches
169
+ * the RegExp).
170
+ */
171
+ async toHaveAttribute(name, value, options) {
172
+ await poll(this.budget(options), this.negated, async () => {
173
+ const v = await this.locator.getAttribute(name, { timeout: 1_000 });
174
+ if (v === null)
175
+ return { pass: false, actual: `${name} was absent` };
176
+ const pass = value === undefined ? true : value instanceof RegExp ? value.test(v) : v === value;
177
+ return { pass, actual: `${name} was ${JSON.stringify(v)}` };
178
+ }, (actual) => this.msg(`have attribute ${name}${value === undefined ? '' : ` ${String(value)}`}`, actual));
179
+ }
180
+ /**
181
+ * The class attribute equals the string (or matches the RegExp).
182
+ * Like Playwright, a string must be the whole value; use a RegExp to
183
+ * check for one class among several.
184
+ */
185
+ async toHaveClass(expected, options) {
186
+ await poll(this.budget(options), this.negated, async () => {
187
+ const v = (await this.locator.getAttribute('class', { timeout: 1_000 })) ?? '';
188
+ const pass = expected instanceof RegExp ? expected.test(v) : normalize(v) === normalize(expected);
189
+ return { pass, actual: `class was ${JSON.stringify(v)}` };
190
+ }, (actual) => this.msg(`have class ${String(expected)}`, actual));
191
+ }
192
+ /** The id attribute equals the string (or matches the RegExp). */
193
+ async toHaveId(expected, options) {
194
+ await this.toHaveAttribute('id', expected, options);
195
+ }
141
196
  /** Exactly `count` matches. */
142
197
  async toHaveCount(count, options) {
143
198
  await poll(this.budget(options), this.negated, async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"expect.js","sourceRoot":"","sources":["../src/expect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,MAAM,OAAO,GAAG,EAAE,CAAC;AACnB,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAE1E,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAE/D,SAAS,WAAW,CAAC,MAAc,EAAE,QAAyB,EAAE,SAAkB;IAChF,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,QAAQ,YAAY,MAAM;QAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,SAAS,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,MAAM,YAAY,OAAO,EAAE,CAAC;QAC9B,OAAO,IAAI,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,8 +12,8 @@
12
12
  */
13
13
  export { Browser, type LaunchOptions } from './browser.ts';
14
14
  export { Page, type ClickVia, type InputMode, type LayoutRect, type ProtocolOptions, type Timeouts } from './page.ts';
15
- export { Locator, type ByRoleOptions, type ByTextOptions } from './locator.ts';
15
+ export { Locator, type ByRoleOptions, type ByTextOptions, type FilterOptions } from './locator.ts';
16
16
  export { expect, LocatorAssertions, PageAssertions, type ExpectOptions } from './expect.ts';
17
- export { test, configure, type RunnerOptions, type TestFixtures } from './runner.ts';
17
+ export { test, configure, defineConfig, type RunnerOptions, type TestFixtures } from './runner.ts';
18
18
  export { WireError, TimeoutError, StrictModeError } from './errors.ts';
19
19
  export { PINNED_VIBESURFER } from './client.ts';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ export { Browser } from "./browser.js";
14
14
  export { Page } from "./page.js";
15
15
  export { Locator } from "./locator.js";
16
16
  export { expect, LocatorAssertions, PageAssertions } from "./expect.js";
17
- export { test, configure } from "./runner.js";
17
+ export { test, configure, defineConfig } from "./runner.js";
18
18
  export { WireError, TimeoutError, StrictModeError } from "./errors.js";
19
19
  export { PINNED_VIBESURFER } from "./client.js";
20
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAuF,MAAM,WAAW,CAAC;AACtH,OAAO,EAAE,OAAO,EAA0C,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAyC,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAuF,MAAM,WAAW,CAAC;AACtH,OAAO,EAAE,OAAO,EAA8D,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAyC,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
package/dist/locator.d.ts CHANGED
@@ -1,10 +1,19 @@
1
1
  /**
2
2
  * Locators: lazy, re-resolving element handles over the a11y tree.
3
3
  *
4
- * A locator stores a query (role + name, text, or label), not a ref.
5
- * Every action and assertion re-resolves the query against a fresh
6
- * view, so locators survive re-renders and navigation. Actions retry
7
- * on STALE_TOKEN and NOT_FOUND until the action timeout elapses.
4
+ * A locator stores a chain of queries, not a ref. Every action and
5
+ * assertion re-resolves the chain against a fresh view, so locators
6
+ * survive re-renders and navigation. Actions retry on STALE_TOKEN and
7
+ * NOT_FOUND until the action timeout elapses.
8
+ *
9
+ * Role, text and label queries match the tree directly. CSS and
10
+ * attribute queries (locator(), getByTestId, getByPlaceholder,
11
+ * getByAltText, getByTitle) run in the page and map each element to
12
+ * its tree node through the `data-vs-ref` attribute vibesurfer puts on
13
+ * every element it reports. An element the tree does not report
14
+ * resolves to the first reported element inside it (a wrapper div),
15
+ * or, with nothing reported inside, to its nearest reported ancestor
16
+ * (a span whose text the tree folded into its parent).
8
17
  */
9
18
  import { type Snapshot, type TreeNode } from './tree.ts';
10
19
  import type { LayoutRect, Page } from './page.ts';
@@ -19,6 +28,18 @@ export interface ByTextOptions {
19
28
  /** String matching is substring, case-insensitive; exact makes it whole-string, case-sensitive. */
20
29
  exact?: boolean;
21
30
  }
31
+ export interface FilterOptions {
32
+ /** Keep matches whose subtree text contains this (substring, case-insensitive) or matches the RegExp. */
33
+ hasText?: string | RegExp;
34
+ /** Drop matches whose subtree text contains this. */
35
+ hasNotText?: string | RegExp;
36
+ /** Keep matches that contain an element matching this locator. */
37
+ has?: Locator;
38
+ /** Drop matches that contain an element matching this locator. */
39
+ hasNot?: Locator;
40
+ /** Keep only visible (true) or only hidden (false) matches. */
41
+ visible?: boolean;
42
+ }
22
43
  export type LocatorQuery = {
23
44
  kind: 'role';
24
45
  role: string;
@@ -31,23 +52,90 @@ export type LocatorQuery = {
31
52
  kind: 'label';
32
53
  text: string | RegExp;
33
54
  options: ByTextOptions;
55
+ } | {
56
+ kind: 'css';
57
+ selector: string;
58
+ } | {
59
+ kind: 'attr';
60
+ method: string;
61
+ attr: string;
62
+ value: string | RegExp;
63
+ exact: boolean;
64
+ } | {
65
+ kind: 'and' | 'or';
66
+ left: Locator;
67
+ right: Locator;
34
68
  };
69
+ /** One link of a chain: a query, its filters, and an optional index. */
70
+ interface Step {
71
+ query: LocatorQuery;
72
+ filters: FilterOptions[];
73
+ /** nth() index; negative counts from the end (last() is -1). */
74
+ index: number | null;
75
+ }
76
+ export type TreeQuery = Extract<LocatorQuery, {
77
+ kind: 'role' | 'text' | 'label';
78
+ }>;
35
79
  export declare function describeQuery(query: LocatorQuery): string;
36
- export declare function findMatches(snap: Snapshot, query: LocatorQuery): TreeNode[];
80
+ /** Tree-query matches over the whole snapshot, in document order. */
81
+ export declare function findMatches(snap: Snapshot, query: TreeQuery): TreeNode[];
82
+ /**
83
+ * Matches of one resolution pass. `inner` holds, for a match found by
84
+ * a DOM query, the refs inside its element: that is the scope a chained
85
+ * query searches.
86
+ */
87
+ interface Found {
88
+ nodes: TreeNode[];
89
+ inner: Map<number, number[]>;
90
+ }
91
+ export declare function byAttr(method: string, attr: string, value: string | RegExp, exact: boolean): LocatorQuery;
37
92
  export declare class Locator {
38
93
  private readonly page;
39
- private readonly query;
40
- private readonly index;
94
+ private readonly steps;
41
95
  /** Refs from the previous visibility resolve, used as the composite layout hint. */
42
96
  private layoutHint;
43
- constructor(page: Page, query: LocatorQuery, index?: number | null);
97
+ constructor(page: Page, steps: Step[] | LocatorQuery);
44
98
  /** The owning page's expect timeout, used as the assertion default. */
45
99
  get expectTimeout(): number;
100
+ private get tail();
101
+ private get index();
102
+ private withTail;
103
+ private chain;
46
104
  /** Pick the first match instead of failing on multiple matches. */
47
105
  first(): Locator;
48
- /** Pick the i-th match (0-based) instead of failing on multiple matches. */
106
+ /** Pick the last match. */
107
+ last(): Locator;
108
+ /** Pick the i-th match (0-based; negative counts from the end). */
49
109
  nth(index: number): Locator;
110
+ /** Narrow the matches by text, by a contained element, or by visibility. */
111
+ filter(options: FilterOptions): Locator;
112
+ /** Elements matching both this locator and `other`. */
113
+ and(other: Locator): Locator;
114
+ /** Elements matching either this locator or `other`, in document order. */
115
+ or(other: Locator): Locator;
116
+ /** A CSS selector (or another locator) searched inside this locator's matches. */
117
+ locator(selector: string | Locator): Locator;
118
+ getByRole(role: string, options?: ByRoleOptions): Locator;
119
+ getByText(text: string | RegExp, options?: ByTextOptions): Locator;
120
+ getByLabel(text: string | RegExp, options?: ByTextOptions): Locator;
121
+ /** Exact match on the test-id attribute (`data-testid` unless configured otherwise). */
122
+ getByTestId(id: string | RegExp): Locator;
123
+ getByPlaceholder(text: string | RegExp, options?: ByTextOptions): Locator;
124
+ getByAltText(text: string | RegExp, options?: ByTextOptions): Locator;
125
+ getByTitle(text: string | RegExp, options?: ByTextOptions): Locator;
50
126
  toString(): string;
127
+ /** Candidates for one query inside `scope` (null: the whole page). */
128
+ private candidates;
129
+ /** What a chained query searches inside `nodes`. */
130
+ private static scopeOf;
131
+ private applyFilter;
132
+ /**
133
+ * Matches of the whole chain inside `scope`. Each step searches the
134
+ * previous step's matches. The outermost locator's own index is left
135
+ * to the caller (strict mode or count); inside a nested locator
136
+ * (has:, and/or) it applies here.
137
+ */
138
+ matchIn(snap: Snapshot, scope: Set<number> | null): Promise<Found>;
51
139
  /**
52
140
  * All current matches against a fresh view. Visible matches are
53
141
  * preferred, judged from the tree alone (hid=1 on self or ancestor):
@@ -106,26 +194,63 @@ export declare class Locator {
106
194
  focus(options?: {
107
195
  timeout?: number;
108
196
  }): Promise<void>;
197
+ /** Click a checkbox or radio unless it is already checked. */
198
+ check(options?: {
199
+ timeout?: number;
200
+ }): Promise<void>;
201
+ /** Click a checkbox unless it is already unchecked. */
202
+ uncheck(options?: {
203
+ timeout?: number;
204
+ }): Promise<void>;
205
+ /**
206
+ * Drag this element onto `target` with a trusted press, move and
207
+ * release from center to center. vibesurfer also fires the HTML5
208
+ * drag events, so native draggable and react-dnd lists see the drop.
209
+ */
210
+ dragTo(target: Locator, options?: {
211
+ timeout?: number;
212
+ }): Promise<void>;
109
213
  /** Full text content of the element via vs_read. */
110
214
  textContent(options?: {
111
215
  timeout?: number;
112
216
  }): Promise<string>;
217
+ /** Same as textContent(): the tree carries rendered text only. */
218
+ innerText(options?: {
219
+ timeout?: number;
220
+ }): Promise<string>;
113
221
  /** Number of current matches (no waiting). */
114
222
  count(): Promise<number>;
223
+ /** One locator per current match, in document order (no waiting). */
224
+ all(): Promise<Locator[]>;
115
225
  /** True if the locator has a visible match right now (no waiting). */
116
226
  isVisible(): Promise<boolean>;
227
+ /** True if the locator has no visible match right now (no waiting). */
228
+ isHidden(): Promise<boolean>;
117
229
  /** Checked state of a checkbox or radio, from the tree (vibesurfer 0.2.12+). */
118
230
  isChecked(options?: {
119
231
  timeout?: number;
120
232
  }): Promise<boolean>;
121
- /** Click a checkbox or radio unless it is already checked. */
122
- check(options?: {
233
+ /** Disabled natively (`disabled`, a disabled fieldset) or with `aria-disabled="true"`. */
234
+ isDisabled(options?: {
123
235
  timeout?: number;
124
- }): Promise<void>;
125
- /** Click a checkbox unless it is already unchecked. */
126
- uncheck(options?: {
236
+ }): Promise<boolean>;
237
+ isEnabled(options?: {
127
238
  timeout?: number;
128
- }): Promise<void>;
239
+ }): Promise<boolean>;
240
+ /** An enabled, writable text control or contenteditable element. */
241
+ isEditable(options?: {
242
+ timeout?: number;
243
+ }): Promise<boolean>;
244
+ /** Whether the element has focus. */
245
+ isFocused(options?: {
246
+ timeout?: number;
247
+ }): Promise<boolean>;
248
+ /** An attribute's value, or null when absent. */
249
+ getAttribute(name: string, options?: {
250
+ timeout?: number;
251
+ }): Promise<string | null>;
252
+ /** DOM state the tree does not carry. */
253
+ private domState;
129
254
  /**
130
255
  * Current value of a text field or select. The tree labels a field
131
256
  * with its value; a password field reads `***` once filled.
@@ -137,14 +262,6 @@ export declare class Locator {
137
262
  boundingBox(options?: {
138
263
  timeout?: number;
139
264
  }): Promise<LayoutRect | null>;
140
- /**
141
- * Drag this element onto `target` with a trusted press, move and
142
- * release from center to center. vibesurfer also fires the HTML5
143
- * drag events, so native draggable and react-dnd lists see the drop.
144
- */
145
- dragTo(target: Locator, options?: {
146
- timeout?: number;
147
- }): Promise<void>;
148
265
  /** The matched element's subtree as template text (see toMatchAriaSnapshot). */
149
266
  ariaSnapshot(options?: {
150
267
  timeout?: number;
@@ -155,3 +272,4 @@ export declare class Locator {
155
272
  refs: number[];
156
273
  }>;
157
274
  }
275
+ export {};