Skip to content

Make Playwright template navigation deterministic - #7604

Merged
thomhurst merged 1 commit into
mainfrom
issue-7601-local-playwright
Nov 5, 2026
Merged

thomhurst merged 1 commit into
mainfrom
issue-7601-local-playwright

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

The Playwright template now fulfills its sample pages with browser route interception. Navigation, title and link assertions, clicking, and URL assertions still run in a real browser, without depending on playwright.dev availability or load time. The template snapshot is updated to match.

Validation:

  • Playwright template instantiation snapshot test: passed (1 test).
  • Release Playwright template execution: passed (2 tests on macOS arm64/net10.0).

Closes #7601

Summary by CodeRabbit

  • Tests
    • The Playwright template test now uses a local test page instead of navigating to an external website. The page includes the title and “Get Started” link checked by the test, so those assertions continue to run against consistent content.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e5b329f-9916-4bb2-8e93-04b353d114f0
Commits

Reviewing files that changed from the base of the PR and between 8593196 and e21e7d2.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Playwright template test now intercepts requests to a local test domain and serves static HTML. It navigates to that domain instead of playwright.dev. The verified snapshot records the same change. Existing assertions remain unchanged.

Changes: Playwright template test

Layer / File(s) Summary
Serve and verify the local test page
src/TUnit.Templates/content/TUnit.Playwright/Tests.cs, tests/TUnit.Templates.Tests/Snapshots/InstantiationTest.TUnit.Playwright._.verified/TUnit.Playwright/Tests.cs
The test serves static HTML for requests to https://tunit-playwright.test/** and navigates to the local URL. The snapshot reflects the change. Existing title, link, click, and URL assertions remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 85931

The template navigation is deterministic, with no identified merge-blocking issue.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Make Playwright template navigation deterministic" matches the main change. The PR makes the Playwright template use browser route interception to serve a local HTML page at https://tunit-p…
Linked Issues check Passed Directly linked issue #7601 requires deterministic Playwright template validation that does not depend on the public playwright.dev website. It also asks that the template keep useful examples, for ex…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes two files only. These are the Playwright template test source and its instantiation snapshot. Both changes implement #7601. The route interception, loc…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title "Make Playwright template navigation deterministic" matches the main change. The PR makes the Playwright template use browser route interception to serve a local HTML page at https://tunit-playwright.test/**, so navigation no longer depends on the availability or load time of playwright.dev. The linked issue #7601 and the commit message describe the same goal.

Full details: Linked Issues check

Explanation

Directly linked issue #7601 requires deterministic Playwright template validation that does not depend on the public playwright.dev website. It also asks that the template keep useful examples, for example by serving local content. At head, src/TUnit.Templates/content/TUnit.Playwright/Tests.cs registers Page.RouteAsync("https://tunit-playwright.test/**", ...). The route fulfills requests with local HTML that has the title TUnit Playwright and a Get Started link with href="/docs/intro". Page.GotoAsync now targets https://tunit-playwright.test/, not https://playwright.dev. The retained checks match the template's examples. They check the title contains Playwright, the link href equals /docs/intro, the link click works, and the URL matches .*intro. The click target /docs/intro falls under the ** route, so the URL assertion still holds on the local content. The template snapshot file tests/TUnit.Templates.Tests/Snapshots/InstantiationTest.TUnit.Playwright._.verified/TUnit.Playwright/Tests.cs has the same diff as the template source, so it matches. The requirements are coding requirements. No public-website dependency remains in the changed test path. Test execution results reported in the PR description were not independently rerun.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes two files only. These are the Playwright template test source and its instantiation snapshot. Both changes implement #7601. The route interception, local HTML body, and new navigation URL replace the public-website navigation. The snapshot change keeps the verified output in sync with the template. No unrelated files or behavior changes appear in the diff. The other template files (GlobalSetup.cs, Hooks.cs, TwoContextFixtureTests.cs, TestProject.csproj) are unchanged.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the page with care,
A local link is waiting there.
The title shines, the button too,
No public site is needed to view.
The rabbit hops; the tests run through.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8c6e51b-d307-4086-8090-54b0f7c0436b
Commits

Reviewing files that changed from the base of the PR and between 5cb7601 and 8593196.

Files selected for processing: 2
  • src/TUnit.Templates/content/TUnit.Playwright/Tests.cs
  • tests/TUnit.Templates.Tests/Snapshots/InstantiationTest.TUnit.Playwright._.verified/TUnit.Playwright/Tests.cs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T22:14:58.718228Z e21e7d2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 85931965d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed change appears safe to merge.

Summary

The Playwright sample now serves fixed HTML through Page.RouteAsync instead of visiting playwright.dev.

  • The Playwright sample test checks a page supplied by its browser route.

Reviews (2) · Last reviewed commit: "Make Playwright template navigation dete..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: looks good.

The template test no longer depends on playwright.dev. Route interception serves the page, so the title, attribute, click and URL assertions still run in a real browser.

I checked that the click on /docs/intro resolves to https://tunit-playwright.test/docs/intro. The ** glob matches it, so the same HTML is served and the .*intro URL assertion passes. The snapshot matches the source file exactly.

Two optional suggestions:

  • The .test TLD is reserved (RFC 2606), so the URL can never collide with a real host. A one-line comment saying so would stop someone from 'fixing' it later.
  • Users copying this template may not realise it is a sandboxed example. The existing comment covers that well enough, so I'd leave it as is.

No blocking issues.

@thomhurst
thomhurst marked this pull request as ready for review November 4, 2026 20:26
@thomhurst

Copy link
Copy Markdown
Owner Author

Both Claude and Codex approved head 85931965d886d7d3ae8348c56f7c33f4239bda49; there are no inline findings or review threads. Claude’s optional comment suggestion needs no code change because the existing comment already explains the sandboxed example.

Marked ready for review with the head unchanged. Waiting for the promotion-triggered Claude review run https://github.com/thomhurst/TUnit/actions/runs/41906608681 and CI. Auto-merge must be armed after that review passes and its findings are checked.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: looks good.

This makes the Playwright template test deterministic by routing https://tunit-playwright.test/** to an in-browser fulfilled page. I traced the flow:

  • The title assertion matches TUnit Playwright.
  • The href="/docs/intro" attribute assertion matches.
  • The click navigates to /docs/intro. The same ** route fulfills that request, so ToHaveURLAsync(.*intro) passes.
  • The template source and the verified snapshot are identical, as expected.

Minor, non-blocking: the template now teaches route mocking rather than a basic GotoAsync. The comment explains why, which is enough. If you want users to see a real-site example, you could mention in the comment that they can replace the route with a real URL.

No issues found.

@thomhurst

Copy link
Copy Markdown
Owner Author

The earlier blocker is cleared: Claude run 41906608681 passed, and the promoted head had positive Claude and Codex verdicts with no blocking findings or review threads.

Windows engine job 126842834984 in run 41906608124 instead reproduced #7554: reflection-mode Run and InstanceMethodDataSource_DoesNotReuseEnumerationInstance remained active for over seven minutes, and the deadline dump ended the child without a TRX report. This is unrelated to the two template files changed here. Main now includes #7606, which isolates the full passing session from sibling engine children and passed hosted Windows validation.

Rebased onto that fresh main in e21e7d2e7eb8cbd0c8e22268645ad1e783bdb302 without conflicts and pushed with an explicit lease. The Playwright template instantiation snapshot test passed (1/1, net10.0), and git diff --check passed. Engine.Tests were not run locally, as repository instructions require CI for them. Fresh CI and reviews must validate the new head before auto-merge is armed; earlier-head approvals are not reused. The existing body still closes #7601; no prerequisite or human decision remains to park this PR behind.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review: LGTM.

Routing the sample pages through Page.RouteAsync removes the dependency on playwright.dev. The test still exercises real navigation, locators, the click and URL assertion. The glob https://tunit-playwright.test/** also matches /docs/intro, so the click navigates to a routed page and ToHaveURLAsync(.*intro) passes. The .test TLD is reserved, so it can never resolve to a real host. The raw string literal indentation is valid, and the snapshot matches the template source.

Optional nit: the template is a starting point for users, so the comment could say that real tests would normally navigate to their own app and drop the routing. It's fine as is.

@thomhurst

Copy link
Copy Markdown
Owner Author

Run 41906608681 completed successfully; that earlier wait is cleared. Current head e21e7d2e7eb8cbd0c8e22268645ad1e783bdb302 has a positive Codex summary and Claude LGTM from run 41923402810. All review surfaces were checked: no inline findings or review threads, and Greptile/CodeRabbit have no blocking findings. Claude's optional comment suggestion needs no change: the existing comment already explains that the sample serves pages in the browser without a public website.

All current CI checks passed (including both hosted engine modes/platform jobs); the mechanical merge gate passed. No remaining prerequisite, replacement PR, or human decision is needed. Proceeding with the squash merge, which closes #7601.

This was referenced Nov 22, 2026

This branch was previously deployed

1 inactive deployment
Pull Requests — e21e7d2e Deployed Nov 4, 2026 by thomhurst via modularpipeline (macos-latest) #21272
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.

Playwright template CI depends on public website load completing within 30 seconds

1 participant