feat(playwright): add Playwright integration package#1396
Conversation
Deploying rstest with
|
| Latest commit: |
07c8abd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f8524861.rstest.pages.dev |
| Branch Preview URL: | https://9aoy-feat-rstest-playwright.rstest.pages.dev |
Rsdoctor Bundle Diff AnalysisFound 14 projects in monorepo, 3 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 playwrightPath:
📁 core/browserPath:
📦 Download Diff Report: core/browser Bundle Diff 📁 core/mainPath:
📦 Download Diff Report: core/main Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new @rstest/playwright package to enable Playwright-driven E2E testing inside Rstest Node.js workers, and documents the integration in both English and Chinese guides. It also extends the core test context metadata by exposing the current test file path via task.filepath.
Changes:
- Add
@rstest/playwrightpackage with Playwright fixtures (browser/context/page/request/serve) and retrying Playwright-style assertions layered on top of Rstestexpect. - Add package-level/unit tests plus an
e2e/playwrightfixture project to validate integration end-to-end. - Add English/Chinese documentation pages and navigation metadata; add
task.filepathto core runner context.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/en/guide/integration/playwright.mdx | English integration guide for @rstest/playwright. |
| website/docs/en/guide/integration/_meta.json | Adds Playwright page to EN integration nav. |
| website/docs/zh/guide/integration/playwright.mdx | Chinese integration guide for @rstest/playwright. |
| website/docs/zh/guide/integration/_meta.json | Adds Playwright page to ZH integration nav. |
| pnpm-lock.yaml | Locks new workspace package + Playwright deps for fixtures. |
| packages/playwright/tsconfig.json | TypeScript build config for the new package. |
| packages/playwright/tests/tsconfig.json | TypeScript config for package tests. |
| packages/playwright/tests/fixture.test.ts | Tests for fixtures (request, serve, options overrides, helper preservation). |
| packages/playwright/tests/expect.test.ts | Tests for retrying locator/page assertions and message handling. |
| packages/playwright/src/index.ts | Public entry exports for fixtures/expect/types. |
| packages/playwright/src/fixture.ts | Implements Playwright fixtures + static server + debug behavior. |
| packages/playwright/src/expect.ts | Implements Playwright-style retrying assertions via proxied expect. |
| packages/playwright/rstest.config.ts | Rstest config for running package tests. |
| packages/playwright/rslib.config.ts | rslib build config and externals for publishing. |
| packages/playwright/README.md | Package README mirroring docs usage/config. |
| packages/playwright/package.json | New published package manifest + deps/peers/scripts. |
| packages/playwright/AGENTS.md | Package contribution guidelines and commands. |
| packages/core/src/types/api.ts | Adds task.filepath to TestContext typing. |
| packages/core/src/runtime/runner/runner.ts | Populates context.task.filepath at runtime. |
| knip.jsonc | Adds knip entry for packages/playwright test files. |
| e2e/playwright/index.test.ts | E2E harness to run fixture project via CLI. |
| e2e/playwright/fixtures/package.json | Fixture project deps for E2E validation. |
| e2e/playwright/fixtures/rstest.config.mts | Fixture project Rstest config (node env, isolate false). |
| e2e/playwright/fixtures/rsbuild.config.ts | Fixture project Rsbuild config to generate a page. |
| e2e/playwright/fixtures/src/index.ts | Fixture app entry content. |
| e2e/playwright/fixtures/index.test.ts | E2E test using page + serve + assertions. |
| e2e/playwright/fixtures/debug.test.ts | E2E test validating debug env behavior (plus a skipped pause test). |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb4f3cf19e
ℹ️ 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".
|
I just remembered: could this PR resolve the excessive boilerplate code found in this file? |
Sure, it provides browser, context, page, request, and static serve fixtures, |
|
#1376 merged, non blocking bug for web-infra-dev/rsbuild#7776. what about release preview version of this PR to verify Playwright integration with web-infra-dev/rsbuild#7776? |
Summary
This PR adds
@rstest/playwrightfor E2E tests that run in Rstest workers and drive complete pages with Playwright. It provides browser, context, page, request, and staticservefixtures, retrying Playwright-style assertions on top of Rstestexpect, headed/debug helpers, and test-local server cleanup. It also exposes the current test file path intask.filepathso extended fixtures can derive per-test cwd when needed.Examples
Basic usage with a prepared page:
Build with Rsbuild first, then open the generated page:
Pause for local debugging:
Checklist