chore(browser-automation): add browsers-automation package, which contains the CDPBridgeAdapter#34232
Open
AtofStryker wants to merge 2 commits into
Open
chore(browser-automation): add browsers-automation package, which contains the CDPBridgeAdapter#34232AtofStryker wants to merge 2 commits into
browsers-automation package, which contains the CDPBridgeAdapter#34232AtofStryker wants to merge 2 commits into
Conversation
3422240 to
71c833c
Compare
browsers-automation package, which contains the CDPBridgeAdapter
7bc4076 to
fec02dc
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fec02dc. Configure here.
|
|
||
| this.scriptIdentifier = identifier | ||
| this.injectedOriginKey = originKey | ||
| } |
Contributor
There was a problem hiding this comment.
Overlapping inject calls race
Medium Severity
inject has no in-flight guard, so overlapping calls (different origins or a re-register still awaiting buildScript / CDP) can each pass the idempotency check, register multiple Page.addScriptToEvaluateOnNewDocument scripts, and leave stale identifiers in CDP while internal state tracks only the last registration.
Reviewed by Cursor Bugbot for commit fec02dc. Configure here.
cypress
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress
|
| Branch Review |
feat/browser-automation-adapter
|
| Run status |
|
| Run duration | 19m 36s |
| Commit |
|
| Committer | Bill Glesias |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
6
|
|
|
1133
|
|
|
0
|
|
|
27494
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
65.33%
|
|
|---|---|
|
|
26
|
|
|
49
|
Accessibility
99.03%
|
|
|---|---|
|
|
0 critical
3 serious
1 moderate
0 minor
|
|
|
18
|
71c833c to
4283fcc
Compare
fec02dc to
45f6857
Compare
…jection Introduce @packages/injection: the page-context, automation-client-agnostic logic that decides what Cypress driver code to inject into the AUT and bundles it as a default-exported string for an automation client (CDP today, BiDi later) to register — the HTTP/2 proxy-bypass path can no longer rewrite AUT HTML at the proxy. - injectAutBridge sets document.domain up front (via the real DocumentDomainInjection), then resolves the per-frame injection level and runs the matching runner source. - Level resolution is superdomain-aware through the injector, and takes the primary origin as an argument rather than reading window.top.location, which a cross-subdomain AUT frame can't access under web security. - Levels are none | full | cross-origin (no separate partial: document.domain glue is applied up front for every frame, so a non-AUT frame has nothing left to inject). - Bundled by rollup into a self-contained IIFE with no runtime dependencies. Tests: vitest unit specs for the pure level resolution and per-frame signal gathering, plus an integration spec that exercises the whole chain unmocked. v8 coverage with the html reporter enabled; .yarnclean keeps istanbul-reports' html assets so it can render. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4283fcc to
a7f3f23
Compare
New @packages/browser-automation: browser-side automation adapters for the HTTP/2 proxy-bypass path, where the MITM proxy is no longer on the AUT traffic path to rewrite HTML. - CdpBridgeInjectionAdapter installs the Cypress bridge (window.Cypress) into the AUT via Page.addScriptToEvaluateOnNewDocument, so it runs before any app script and survives cy.reload() / same-tab navigations. It registers for a primary origin supplied by the caller and re-registers (detach + attach) when that origin changes, keyed on the injector-reduced (super)domain so same-origin navigations don't churn. - AbstractBridgeInjection: transport-agnostic base that wraps the @packages/injection document-context bundle and serializes the primary origin, document.domain config, cross-origin config, and runner sources (from @packages/resolve-dist) into the injectAutBridge(...) call. Concrete adapters implement inject() per transport. - Depends on @packages/injection, @packages/resolve-dist, and @packages/network-tools; deliberately free of any @packages/server dependency to avoid a cycle. Spike for #33849 (full / same-origin) and #33859 (cross-origin). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45f6857 to
6c90248
Compare
a7f3f23 to
0508e2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Additional details
Adds
@packages/browser-automation: the transport adapters that actually register the injection bundle in the browser. Builds on@packages/injection(previous stack entry).CdpBridgeInjectionAdapterassembles the@packages/injectionbundle + the runner sources (from@packages/resolve-dist) and registers it over CDPPage.addScriptToEvaluateOnNewDocument, so it runs before any app script and survivescy.reload()/ same-tab navigations. It registers for a caller-supplied primary origin and re-registers (detach + attach) when the top-frame origin changes, keyed on the injector-reduced (super)domain so same-origin navigations don't churn.AbstractBridgeInjectionis the transport-agnostic base (assembles the injectable source);CdpBridgeInjectionAdapteris the CDP implementation. Kept free of any@packages/serverdependency to avoid a cycle.Part of the HTTP/2 program (#33919): #33849 (full / same-origin), #33859 (cross-origin).
Note
Medium Risk
Touches core AUT bridge delivery (script assembly and CDP registration) for upcoming proxy-bypass behavior, but the package is not integrated into the runner yet and is covered by focused unit tests.
Overview
Introduces
@packages/browser-automation, an internal package that will install the Cypress AUT bridge when traffic no longer goes through the proxy (HTTP/2 / bypass path). Nothing in@packages/serveris wired yet; knip is updated to track the new workspace.AbstractBridgeInjectionbuilds the injectable script by combining the@packages/injectionbundle, runner sources from@packages/resolve-dist, and serialized document-domain / cross-origin config into a call toCypressInjection.injectAutBridge(...).CdpBridgeInjectionAdapterregisters that script via CDPPage.addScriptToEvaluateOnNewDocument, with lifecycle keyed onDocumentDomainInjection.getOriginso repeat calls for the same reduced origin are no-ops and real origin changes trigger remove-then-add. Unparseable primary origins throw instead of skipping injection.Exports the CDP adapter and a local
ForAutBridgeInjectionport; CDPsendis typed locally to avoid a@packages/serverdependency. Vitest covers register/re-register behavior, subdomain vs superdomain keying, and assembled script shape.Reviewed by Cursor Bugbot for commit 6c90248. Bugbot is set up for automated code reviews on this repo. Configure here.
Steps to test
yarn workspace @packages/browser-automation test— the adapter's register / re-register (detach + attach) lifecycle and the assembled-script shape.yarn workspace @packages/browser-automation check-ts/lint.How has the user experience changed?
No change. New internal package; wired into the server in the next stack entry.
PR Tasks
cypress-documentation?type definitions?