Skip to content

Add the Playwright Interactor adapter - #324

Draft
cowboyd wants to merge 1 commit into
codex/cli-dual-runtimefrom
codex/interactors-playwright
Draft

Add the Playwright Interactor adapter#324
cowboyd wants to merge 1 commit into
codex/cli-dual-runtimefrom
codex/interactors-playwright

Conversation

@cowboyd

@cowboyd cowboyd commented Sep 4, 2026

Copy link
Copy Markdown
Member

Motivation

The compiled artifact set needs a Playwright-side consumer that is type-safe in the test process while executing the real Interactor implementation against the browser DOM.

Approach

Add @interactors/playwright, which validates the compiled registry, installs the browser agent for the current document and later navigations, and exposes typed remote proxies derived from the generated declarations. Commands cross page.evaluate() with protocol and registry identity, supporting actions, assertions, nested Interactors, regular expressions, and built-in or custom matchers. Remote failures retain their browser error details.

Remote proxies intentionally omit raw filter getter methods. Tests assert filter values through has() or is(), preserving Interactors' convergence and diagnostics instead of extracting a value for a runner-side equality assertion.

Register the package with the release configuration and derive prerelease npm tags from Git tags so alpha releases remain off latest.

Alternate Designs

Reimplementing Interactors with Playwright locators would duplicate behavior and allow the two implementations to drift. Importing browser-oriented constructors directly into the Playwright process would execute them in the wrong DOM context. The proxy and agent boundary keeps one implementation in the browser.

Possible Drawbacks or Risks

Command inputs must be JSON-shaped values, regular expressions, or remote matchers, and returned values must be serializable by Playwright. The current transport targets the page's main frame and expects one loader call per Page; popup pages must be loaded separately.

TODOs and Open Questions

Supporting child-frame-specific adapters can be considered separately.

Learning

Playwright's init-script lifecycle applies to both navigations and child frames. The adapter guards installation to the main frame and disposes the registered script when its initial agent handshake fails.

Code passed to page.evaluate() cannot safely close over DNT-generated module shims. Browser callbacks instead discover their window through the document passed across the Playwright boundary.

Screenshots

Not applicable; this is a test-runner integration API.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through 80cf510

There are 1 changes which include @interactors/core with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@interactors/core 1.0.1 1.1.0
@interactors/cli 1.0.0 1.0.1
@interactors/keyboard 1.0.1 1.0.2
@interactors/html 1.0.1 1.0.2
@interactors/material-ui 5.0.0 5.0.1
@interactors/playwright 1.0.0 1.0.1

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deploy Preview Ready!

@cowboyd cowboyd changed the title codex/interactors playwright Add the Playwright Interactor adapter Sep 4, 2026
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from 5916a9c to ad602fb Compare September 5, 2026 20:43
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from ad602fb to 68c3b9f Compare September 8, 2026 21:19
@cowboyd
cowboyd changed the base branch from codex/interactors-compile to codex/cli-dual-runtime September 8, 2026 21:48
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from 68c3b9f to bd126ec Compare September 8, 2026 22:00
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from bd126ec to 2e8565c Compare September 8, 2026 22:05
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from 2e8565c to a00e413 Compare September 9, 2026 02:02
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from a00e413 to 0b8f5ed Compare September 9, 2026 03:04
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from 0b8f5ed to 9f43095 Compare September 9, 2026 03:32
@cowboyd
cowboyd force-pushed the codex/interactors-playwright branch from 9f43095 to b40d07d Compare September 9, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant