-
Notifications
You must be signed in to change notification settings - Fork 1.1k
test: e2e playwright implementation #1389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikehardy
wants to merge
9
commits into
main
Choose a base branch
from
test/e2e-playwright-design
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,945
−3,636
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
266423f
test: add developer-docs bundle for Playwright e2e design
mikehardy 04530b9
test(e2e): install/configure playwright, implement react e2e smoke test
mikehardy 93911c1
test: working e2e tests for shadcn, nextjs, and nextjs-ssr
mikehardy afd1356
fix(angular): use AngularFire peer provider for FirebaseUI
mikehardy 1ab4cb1
test(angular): e2e test for angular example
mikehardy c772577
ci(e2e): harden workflow triggers and browser cache
mikehardy 6853c2b
test(e2e): add custom-auth-server HTTP smoke on :4001
mikehardy 483d996
fix: consolidated fixes from deep review
mikehardy def7980
test(deps): pin workflow actions to SHAs / restrict permissions
mikehardy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: E2E | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "packages/**" | ||
| - "examples/**" | ||
| - "e2e/**" | ||
| - "scripts/**" | ||
| - "firebase.json" | ||
| - ".github/workflows/e2e.yaml" | ||
| - ".github/workflows/test.yaml" | ||
| - "package.json" | ||
| - "pnpm-lock.yaml" | ||
| - "pnpm-workspace.yaml" | ||
| pull_request: | ||
| paths: | ||
| - "packages/**" | ||
| - "examples/**" | ||
| - "e2e/**" | ||
| - "scripts/**" | ||
| - "firebase.json" | ||
| - ".github/workflows/e2e.yaml" | ||
| - ".github/workflows/test.yaml" | ||
| - "package.json" | ||
| - "pnpm-lock.yaml" | ||
| - "pnpm-workspace.yaml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| ui-e2e: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | ||
| with: | ||
| version: 10.34.4 | ||
|
|
||
| - name: Setup node | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 22.13.0 | ||
| cache: pnpm | ||
| cache-dependency-path: pnpm-lock.yaml | ||
|
|
||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Resolve Playwright version | ||
| id: playwright-version | ||
| run: | | ||
| version="$(pnpm --filter=e2e exec node -p "require('@playwright/test/package.json').version")" | ||
| echo "playwright-version=${version}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Cache Playwright browsers | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| with: | ||
| path: ~/.cache/ms-playwright | ||
| key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.playwright-version }} | ||
|
|
||
| - name: Install Playwright browsers | ||
| run: pnpm --filter=e2e exec playwright install --with-deps chromium | ||
|
|
||
| - name: Run UI e2e smoke | ||
| run: pnpm test:e2e | ||
|
|
||
| - name: Upload Playwright report and coverage | ||
| if: always() | ||
| uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 | ||
| with: | ||
| name: e2e-artifacts | ||
| path: | | ||
| e2e/playwright-report/ | ||
| e2e/coverage-report/ | ||
| if-no-files-found: ignore |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Agent entry point | ||
|
|
||
| Start at [developer-docs/index.md](developer-docs/index.md). | ||
|
|
||
| **Before editing documentation:** read [developer-docs/documentation-policy.md](developer-docs/documentation-policy.md). | ||
|
|
||
| For architecture or testing work, also read: | ||
|
|
||
| * [developer-docs/decisions.md](developer-docs/decisions.md) — `AD-<number>` decision log | ||
| * [developer-docs/work-queues/playwright-e2e-smoke.md](developer-docs/work-queues/playwright-e2e-smoke.md) — active Playwright backlog | ||
|
|
||
| Human onboarding (commands, emulator): [LOCAL_DEVELOPMENT.md](LOCAL_DEVELOPMENT.md) owns that content; do not duplicate here. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| --- | ||
| type: Reference | ||
| title: Examples inventory | ||
| description: How each monorepo example is started, which port it uses, and emulator requirements. | ||
| resource: firebaseui-web/examples/ | ||
| tags: [examples, monorepo, emulator] | ||
| timestamp: 2026-07-01T00:00:00Z | ||
| --- | ||
|
|
||
| # Workspace layout | ||
|
|
||
| pnpm workspace members: `packages/*`, `examples/*` ([pnpm-workspace.yaml](../../pnpm-workspace.yaml)). Examples consume `@firebase-oss/ui-*` via `workspace:*`. | ||
|
|
||
| # Examples in scope for e2e smoke | ||
|
|
||
| | Example | pnpm filter | Dev command | Default port | E2E port | Emulator in dev | Smoke type | | ||
| | ------------------ | -------------------- | --------------------------------------------- | ------------- | -------- | -------------------------------------------------- | -------------------------- | | ||
| | react | `react` | `vite` | 5173 | 5173 | `import.meta.env.MODE === "development"` → `:9099` | browser (S1–S3) | | ||
| | shadcn | `shadcn` | `vite` | 5173 | 5174 | same as react | browser (S1–S3) | | ||
| | nextjs (SSG) | `nextjs` | `next dev --turbopack` | 3000 | 3000 | `NODE_ENV === "development"` → `:9099` | browser (S1–S3) | | ||
| | nextjs-ssr | `nextjs-ssr` | `next dev` | 3000 | 3001 | same as nextjs | browser (S1–S3) | | ||
| | angular-example | `angular-example` | `run start --port 4200` (`clean && ng serve`) | 4200 | 4200 | `isDevMode()` → `:9099` | browser (S1–S3) | | ||
| | custom-auth-server | `custom-auth-server` | `start` (built Express) | 4000 (`PORT`) | 4001 | n/a (uses `firebase-admin`) | HTTP boot + `fetch`/`curl` | | ||
|
|
||
| **Port configurability:** not pinned in `vite.config.ts` / `next.config.ts`. All examples accept CLI/`PORT` overrides for e2e; Playwright's top-level `webServer` (selected by `E2E_PROJECT`) owns lifecycle. Exact e2e commands: `e2e/fixtures/example-meta.ts`. See [AD-4](../decisions.md#ad-4-playwright-managed-dev-servers-serial-shared-emulator). | ||
|
|
||
| **custom-auth-server port:** default `:4000` collides with the Firebase Emulator UI (`:4000`), so e2e binds `:4001` — [AD-6](../decisions.md#ad-6-custom-auth-server-binds-4001-for-e2e). Its smoke is non-browser (boot + HTTP assert); it is not in root `pnpm build`. | ||
|
|
||
| **Angular:** e2e reuses the package `start` script (`pnpm clean && ng serve`) so the `.angular/cache` clean is not duplicated — [AD-4](../decisions.md#ad-4-playwright-managed-dev-servers-serial-shared-emulator). | ||
|
|
||
| **Auth behaviors affecting smoke:** react/shadcn use `oneTapSignIn`; nextjs/nextjs-ssr use `autoAnonymousLogin`. Neither hides the sign-in form (`SignInAuthScreen` renders regardless of auth state), so E2E flags are optional — [AD-5](../decisions.md#ad-5-auth-behavior-e2e-flags-are-optional-only-if-flaky). The One Tap external script is blocked in the harness. | ||
|
|
||
| **Next.js paths:** both nextjs (SSG) and nextjs-ssr use `trailingSlash: true` — e2e URLs end with `/` (e.g. `/screens/sign-in-auth-screen-w-handlers/`). | ||
|
|
||
| **Forgot-password route varies per example** (S3 asserts rendered UI, not a fixed path): | ||
|
|
||
| | Example | Forgot-password route from sign-in-with-handlers | | ||
| | ---------------------- | ------------------------------------------------ | | ||
| | react, angular-example | `/screens/forgot-password-auth-screen` | | ||
| | shadcn | `/screens/forgot-password-screen` | | ||
| | nextjs, nextjs-ssr | `/screens/forgot-password-auth-screen` | | ||
|
|
||
| # Shared prerequisites | ||
|
|
||
| 1. `pnpm install` | ||
| 2. `pnpm build:packages` (or full `pnpm build` in CI) | ||
| 3. Auth emulator: `pnpm emulators` → `http://localhost:9099` ([firebase.json](../../firebase.json)) | ||
|
|
||
| Procedural steps: [LOCAL_DEVELOPMENT.md](../../LOCAL_DEVELOPMENT.md) (owner for command copy-paste). | ||
|
|
||
| # Smoke test entry path (all UI examples) | ||
|
|
||
| Deep-link: `/screens/sign-in-auth-screen-w-handlers` (with trailing slash for Next). Smoke scope: [AD-3](../decisions.md#ad-3-playwright-example-smoke-tests-mvp-scope-dev-server). | ||
|
|
||
| # Citations | ||
|
|
||
| [1] [LOCAL_DEVELOPMENT.md](../../LOCAL_DEVELOPMENT.md) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| type: Reference | ||
| title: Testing strategy | ||
| description: Verification layers for firebaseui-web packages and examples. | ||
| tags: [testing, ci, playwright] | ||
| timestamp: 2026-07-03T00:00:00Z | ||
| --- | ||
|
|
||
| # Layers | ||
|
|
||
| | Layer | Command | Owner doc | Catches | | ||
| |-------|---------|-----------|---------| | ||
| | Package unit tests | `pnpm test` | [CONTRIBUTING.md](../../CONTRIBUTING.md) | Core/react/angular/shadcn/translations/styles logic | | ||
| | Compile (packages + examples) | `pnpm build` | [CONTRIBUTING.md](../../CONTRIBUTING.md) | TS, bundler, framework build errors | | ||
| | Lint / format | `pnpm lint:check`, `pnpm format:check` | [CONTRIBUTING.md](../../CONTRIBUTING.md) | Style regressions | | ||
| | Example smoke (browser + HTTP) | `pnpm test:e2e` | [AD-3](../decisions.md#ad-3-playwright-example-smoke-tests-mvp-scope-dev-server), [AD-4](../decisions.md#ad-4-playwright-managed-dev-servers-serial-shared-emulator), [AD-6](../decisions.md#ad-6-custom-auth-server-binds-4001-for-e2e) | Dev-server UI interactivity (five UI examples) and `custom-auth-server` HTTP boot | | ||
| | Security audit | `pnpm audit` | [playbooks/dependency-update-verification.md](../playbooks/dependency-update-verification.md) | Known CVEs in lockfile | | ||
|
|
||
| # CI today | ||
|
|
||
| [`.github/workflows/test.yaml`](../../.github/workflows/test.yaml): `pnpm build`, Auth emulator start, `pnpm test`. | ||
|
|
||
| [`.github/workflows/e2e.yaml`](../../.github/workflows/e2e.yaml): `pnpm test:e2e` (six examples), Playwright Chromium, HTML/coverage artifacts — [AD-7](../decisions.md#ad-7-e2e-runs-in-a-separate-ci-workflow-with-broad-triggers). Auth emulator is ensured by Playwright `globalSetup` (reuse-aware). | ||
|
|
||
| # Gaps | ||
|
|
||
| * Skipped package integration tests (`describe.skip`). | ||
| * `custom-auth-server` not built by root `pnpm build` (e2e builds it on demand). | ||
| * Production build artifacts not exercised by e2e — deferred, [AD-8](../decisions.md#ad-8-production-artifact-e2e-deferred-future-phase). | ||
| * `pnpm audit` not gated in CI. | ||
|
|
||
| # Post-dependency-update gate (target) | ||
|
|
||
| See [playbooks/dependency-update-verification.md](../playbooks/dependency-update-verification.md). |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wiz flags a file if it has problems and you touch it - I touched this (and tset.yaml) to pin the pnpm version, so I had to then pin all the SHAs for actions in order to satisfy wiz