Skip to content

Commit 29bcc9a

Browse files
committed
fix: consolidated fixes from deep review
CI (e2e.yaml): path filters for scripts/** and firebase.json; frozen lockfile; pnpm/action-setup before setup-node so store cache restores; Playwright browser cache without restore-keys; Auth emulator started by Playwright globalSetup; HTML/JSON/coverage artifacts uploaded every run. E2E runtime: webServer timeouts 240s (angular) and 180s (nextjs); global expect.timeout 30s; serial emulator via E2E_KEEP_EMULATOR and runner postflight; e2e package test runs full serial runner; S3 asserts per-example forgot-password route; custom-auth-server spawn node build/index.js directly (see package.json start) to avoid pnpm SIGTERM noise on teardown. Emulator config: e2e/firebase.emulator.json is auth-only — no global webframeworks experiment mutation during pnpm test:e2e. Coverage: V8 precise coverage summary uses weightedExecUnits (byte-range × count); shared reset in e2e/fixtures/coverage-artifacts.mjs; raw.jsonl compresses well in upload-artifact zip. Toolchain: firebase-tools version parsed from test.yaml at e2e globalSetup; root packageManager pnpm@10.34.4 (Phase 6 bump target). Lockfile: exclude @angular/fire optional firebase-tools peer via pnpm-workspace overrides; emulator tooling remains npx/global CLI; remove stray examples/nextjs-ssr/package-lock.json. Docs: LOCAL_DEVELOPMENT and dependency playbook document test:e2e; AD-4 top-level webServer; AD-7 broad path triggers; examples-inventory owns ports/commands; testing-strategy reflects globalSetup emulator; documentation-policy root links fixed; remove session log and redundant OKF index stubs per documentation-policy. CI: correct upload-artifact SHA (v4.6.1); pin pnpm 10.34.4 in e2e/lint/test workflows to match packageManager; e2e path triggers include test.yaml. E2E: S3 asserts rendered forgot-password UI only (no URL check per AD-3); globalSetup spawns firebase-tools via npx argv (shell: false); strict TS for firebase-tools version parse; V8 weightedExecUnits skips unexecuted ranges.
1 parent 1f74d72 commit 29bcc9a

31 files changed

Lines changed: 524 additions & 6225 deletions

.github/workflows/e2e.yaml

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'packages/**'
9-
- 'examples/**'
10-
- 'e2e/**'
11-
- '.github/workflows/e2e.yaml'
12-
- 'package.json'
13-
- 'pnpm-lock.yaml'
14-
- 'pnpm-workspace.yaml'
8+
- "packages/**"
9+
- "examples/**"
10+
- "e2e/**"
11+
- "scripts/**"
12+
- "firebase.json"
13+
- ".github/workflows/e2e.yaml"
14+
- ".github/workflows/test.yaml"
15+
- "package.json"
16+
- "pnpm-lock.yaml"
17+
- "pnpm-workspace.yaml"
1518
pull_request:
1619
paths:
17-
- 'packages/**'
18-
- 'examples/**'
19-
- 'e2e/**'
20-
- '.github/workflows/e2e.yaml'
21-
- 'package.json'
22-
- 'pnpm-lock.yaml'
23-
- 'pnpm-workspace.yaml'
20+
- "packages/**"
21+
- "examples/**"
22+
- "e2e/**"
23+
- "scripts/**"
24+
- "firebase.json"
25+
- ".github/workflows/e2e.yaml"
26+
- ".github/workflows/test.yaml"
27+
- "package.json"
28+
- "pnpm-lock.yaml"
29+
- "pnpm-workspace.yaml"
2430

2531
permissions:
2632
contents: read
@@ -32,19 +38,20 @@ jobs:
3238
- name: Checkout
3339
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3440

41+
- name: Setup pnpm
42+
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
43+
with:
44+
version: 10.34.4
45+
3546
- name: Setup node
3647
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3748
with:
3849
node-version: 22.13.0
39-
check-latest: true
40-
41-
- name: Setup pnpm
42-
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
43-
with:
44-
version: 10
50+
cache: pnpm
51+
cache-dependency-path: pnpm-lock.yaml
4552

4653
- name: Install dependencies
47-
run: pnpm install
54+
run: pnpm install --frozen-lockfile
4855

4956
- name: Resolve Playwright version
5057
id: playwright-version
@@ -57,27 +64,19 @@ jobs:
5764
with:
5865
path: ~/.cache/ms-playwright
5966
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.playwright-version }}
60-
restore-keys: |
61-
playwright-${{ runner.os }}-
62-
63-
- name: Install Firebase CLI
64-
run: npm i -g firebase-tools@14.15.2
65-
66-
- name: Enable webframeworks experiment
67-
run: firebase experiments:enable webframeworks
68-
69-
- name: Start Firebase emulator
70-
run: |
71-
firebase emulators:start --only auth --project demo-test &
72-
sleep 15
73-
until wget -q --spider http://localhost:9099 2>/dev/null; do
74-
echo "Waiting for emulator to start..."
75-
sleep 2
76-
done
77-
echo "Emulator is ready"
7867

7968
- name: Install Playwright browsers
8069
run: pnpm --filter=e2e exec playwright install --with-deps chromium
8170

8271
- name: Run UI e2e smoke
8372
run: pnpm test:e2e
73+
74+
- name: Upload Playwright report and coverage
75+
if: always()
76+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
77+
with:
78+
name: e2e-artifacts
79+
path: |
80+
e2e/playwright-report/
81+
e2e/coverage-report/
82+
if-no-files-found: ignore

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup pnpm
2424
uses: pnpm/action-setup@v4
2525
with:
26-
version: 10
26+
version: 10.34.4
2727

2828
- name: Install addlicense
2929
run: |

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup pnpm
2323
uses: pnpm/action-setup@v4
2424
with:
25-
version: 10
25+
version: 10.34.4
2626

2727
- name: Install addlicense
2828
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ coverage
2727
# Playwright
2828
e2e/test-results/
2929
e2e/.state/
30+
e2e/playwright-report/
31+
e2e/coverage-report/
3032
playwright-report/
3133

3234
# Firebase

LOCAL_DEVELOPMENT.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ if (import.meta.env.MODE === "development") {
116116
```
117117

118118
Each framework detects dev mode differently:
119+
119120
- **Vite examples** (react, shadcn): `import.meta.env.MODE === "development"`
120121
- **Next.js examples**: `process.env.NODE_ENV === "development"`
121122
- **Angular**: `isDevMode()` from `@angular/core`
@@ -124,29 +125,37 @@ All automatic when using the `dev` / `start` scripts.
124125

125126
## Which example app should I use?
126127

127-
| I'm working on... | Use this example |
128-
|---|---|
129-
| Core auth logic, sign-in flows, state | `react` |
130-
| React components, hooks, UI | `react` |
131-
| Angular components or DI | `angular` |
132-
| Shadcn components or theming | `shadcn` |
133-
| Server-side rendering, server components | `nextjs-ssr` |
134-
| Static Next.js / client-only | `nextjs` |
135-
| Translations or CSS | `react` (easiest) |
136-
| Custom OAuth flows | `custom-auth-server` (see [CUSTOM_AUTHENTICATION.md](CUSTOM_AUTHENTICATION.md)) |
128+
| I'm working on... | Use this example |
129+
| ---------------------------------------- | ------------------------------------------------------------------------------- |
130+
| Core auth logic, sign-in flows, state | `react` |
131+
| React components, hooks, UI | `react` |
132+
| Angular components or DI | `angular` |
133+
| Shadcn components or theming | `shadcn` |
134+
| Server-side rendering, server components | `nextjs-ssr` |
135+
| Static Next.js / client-only | `nextjs` |
136+
| Translations or CSS | `react` (easiest) |
137+
| Custom OAuth flows | `custom-auth-server` (see [CUSTOM_AUTHENTICATION.md](CUSTOM_AUTHENTICATION.md)) |
137138

138139
The `react` example is recommended as the default — it has the fastest reload cycle.
139140

140141
## Running tests
141142

142-
Start the emulator first, then:
143+
Start the emulator first (or let `pnpm test:e2e` start it via Playwright `globalSetup` when it is not already running), then:
143144

144145
```bash
145-
# All tests:
146+
# Package unit tests:
146147
pnpm test
148+
149+
# Example smoke (all six examples, serial):
150+
pnpm test:e2e
151+
152+
# Single example smoke:
153+
pnpm test:e2e:react
154+
pnpm test:e2e:angular
155+
# … see root package.json for test:e2e:<example> scripts
147156
```
148157

149-
Planned example browser smoke tests (`pnpm test:e2e`) are described in [developer-docs/work-queues/playwright-e2e-smoke.md](developer-docs/work-queues/playwright-e2e-smoke.md).
158+
E2E scope and CI layers: [developer-docs/architecture/testing-strategy.md](developer-docs/architecture/testing-strategy.md).
150159

151160
```bash
152161
# Watch mode (core, react, angular):

developer-docs/architecture/examples-inventory.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ pnpm workspace members: `packages/*`, `examples/*` ([pnpm-workspace.yaml](../../
1313

1414
# Examples in scope for e2e smoke
1515

16-
| Example | pnpm filter | Dev command | Default port | E2E port | Emulator in dev | Smoke type |
17-
|---------|-------------|-------------|--------------|----------|-----------------|------------|
18-
| react | `react` | `vite` | 5173 | 5173 | `import.meta.env.MODE === "development"``:9099` | browser (S1–S3) |
19-
| shadcn | `shadcn` | `vite` | 5173 | 5174 | same as react | browser (S1–S3) |
20-
| nextjs (SSG) | `nextjs` | `next dev --turbopack` | 3000 | 3000 | `NODE_ENV === "development"``:9099` | browser (S1–S3) |
21-
| nextjs-ssr | `nextjs-ssr` | `next dev` | 3000 | 3001 | same as nextjs | browser (S1–S3) |
22-
| angular-example | `angular-example` | `run start` (`clean && ng serve`) | 4200 | 4200 | `isDevMode()``:9099` | browser (S1–S3) |
23-
| custom-auth-server | `custom-auth-server` | `start` (built Express) | 4000 (`PORT`) | 4001 | n/a (uses `firebase-admin`) | HTTP boot + `fetch`/`curl` |
16+
| Example | pnpm filter | Dev command | Default port | E2E port | Emulator in dev | Smoke type |
17+
| ------------------ | -------------------- | --------------------------------------------- | ------------- | -------- | -------------------------------------------------- | -------------------------- |
18+
| react | `react` | `vite` | 5173 | 5173 | `import.meta.env.MODE === "development"``:9099` | browser (S1–S3) |
19+
| shadcn | `shadcn` | `vite` | 5173 | 5174 | same as react | browser (S1–S3) |
20+
| nextjs (SSG) | `nextjs` | `next dev --turbopack` | 3000 | 3000 | `NODE_ENV === "development"``:9099` | browser (S1–S3) |
21+
| nextjs-ssr | `nextjs-ssr` | `next dev` | 3000 | 3001 | same as nextjs | browser (S1–S3) |
22+
| angular-example | `angular-example` | `run start --port 4200` (`clean && ng serve`) | 4200 | 4200 | `isDevMode()``:9099` | browser (S1–S3) |
23+
| custom-auth-server | `custom-auth-server` | `start` (built Express) | 4000 (`PORT`) | 4001 | n/a (uses `firebase-admin`) | HTTP boot + `fetch`/`curl` |
2424

25-
**Port configurability:** not pinned in `vite.config.ts` / `next.config.ts`. All examples accept CLI/`PORT` overrides for e2e; Playwright's per-project `webServer` owns lifecycle. See [AD-4](../decisions.md#ad-4-playwright-managed-dev-servers-serial-shared-emulator).
25+
**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).
2626

2727
**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`.
2828

@@ -34,11 +34,11 @@ pnpm workspace members: `packages/*`, `examples/*` ([pnpm-workspace.yaml](../../
3434

3535
**Forgot-password route varies per example** (S3 asserts rendered UI, not a fixed path):
3636

37-
| Example | Forgot-password route from sign-in-with-handlers |
38-
|---------|--------------------------------------------------|
39-
| react, angular-example | `/screens/forgot-password-auth-screen` |
40-
| shadcn | `/screens/forgot-password-screen` |
41-
| nextjs, nextjs-ssr | `/screens/forgot-password-auth-screen` |
37+
| Example | Forgot-password route from sign-in-with-handlers |
38+
| ---------------------- | ------------------------------------------------ |
39+
| react, angular-example | `/screens/forgot-password-auth-screen` |
40+
| shadcn | `/screens/forgot-password-screen` |
41+
| nextjs, nextjs-ssr | `/screens/forgot-password-auth-screen` |
4242

4343
# Shared prerequisites
4444

@@ -50,7 +50,7 @@ Procedural steps: [LOCAL_DEVELOPMENT.md](../../LOCAL_DEVELOPMENT.md) (owner for
5050

5151
# Smoke test entry path (all UI examples)
5252

53-
Deep-link: `/screens/sign-in-auth-screen-w-handlers` (with trailing slash for Next). Details: [work-queues/playwright-e2e-smoke.md](../work-queues/playwright-e2e-smoke.md).
53+
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).
5454

5555
# Citations
5656

developer-docs/architecture/index.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

developer-docs/architecture/testing-strategy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ timestamp: 2026-07-03T00:00:00Z
2020

2121
[`.github/workflows/test.yaml`](../../.github/workflows/test.yaml): `pnpm build`, Auth emulator start, `pnpm test`.
2222

23-
[`.github/workflows/e2e.yaml`](../../.github/workflows/e2e.yaml): `pnpm test:e2e` (six examples), Auth emulator, Playwright Chromium[AD-7](../decisions.md#ad-7-e2e-runs-in-a-separate-ci-workflow-with-broad-triggers).
23+
[`.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).
2424

2525
# Gaps
2626

developer-docs/decisions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Example apps are verified with **Playwright smoke tests**, not full user-flow e2
3030

3131
## AD-4: Playwright-managed dev servers, serial, shared emulator
3232

33-
Each example has a **unique e2e port** (react 5173, shadcn 5174, nextjs 3000, nextjs-ssr 3001, angular 4200, custom-auth-server 4001). Playwright's per-project **`webServer`** starts each example's dev server, waits for its URL, and stops it — replacing hand-rolled preflight/postflight/PID scripts. Execution is **serial** (`workers: 1`, one dev server up at a time selected via `E2E_PROJECT`) for resource predictability and clean logs; because ports are unique, parallelization is possible later but deferred ([Deferred](work-queues/playwright-e2e-smoke.md#deferred)). **`globalSetup`** builds packages (`build:packages`, asserting `dist/` exists — examples consume built `@firebase-oss/ui-*`) and ensures a single Auth emulator on `:9099` for the whole run; **`globalTeardown`** stops what it started. Angular reuses its package `start` semantics (`pnpm clean && ng serve`) rather than duplicating the `.angular/cache` clean.
33+
Each example has a **unique e2e port** — see [examples-inventory.md](architecture/examples-inventory.md). Playwright's **top-level** `webServer` (one at a time, selected via `E2E_PROJECT`) starts each UI example's dev server, waits for its URL, and stops it — replacing hand-rolled preflight/postflight/PID scripts. Execution is **serial** (`workers: 1`) for resource predictability and clean logs; because ports are unique, parallelization is possible later but deferred ([Deferred](work-queues/playwright-e2e-smoke.md#deferred)). **`globalSetup`** builds packages (`build:packages`, asserting `dist/` exists — examples consume built `@firebase-oss/ui-*`), ensures a single Auth emulator on `:9099` for the whole run (reuse-aware), and starts it when not already running; **`globalTeardown`** stops what globalSetup started unless the serial runner is mid-suite (`E2E_KEEP_EMULATOR=1`). Angular reuses its package `start` semantics (`pnpm clean && ng serve`) rather than duplicating the `.angular/cache` clean.
3434

3535
---
3636

@@ -50,7 +50,7 @@ The Express `custom-auth-server` defaults to `:4000`, which collides with the **
5050

5151
## AD-7: e2e runs in a separate CI workflow with broad triggers
5252

53-
Browser smoke runs in its **own workflow**, not folded into the unit `test.yaml`. Path-filtering is intentionally **broad**: examples depend on `packages/**` (built `@firebase-oss/ui-*`), the root `package.json`, `pnpm-lock.yaml`, and the `pnpm-workspace.yaml` catalog, so narrow `examples/**`-only filters would miss real regressions. Triggers therefore include packages, examples, root manifests, lockfile, workspace catalog, and the e2e/workflow files themselves. Playwright browser binaries are **cached keyed on the resolved Playwright version** so the cache restores the actual browser artifact; Chromium-only for MVP.
53+
Browser smoke runs in its **own workflow**, not folded into the unit `test.yaml`. Path-filtering is intentionally **broad**: examples depend on `packages/**` (built `@firebase-oss/ui-*`), `scripts/**` (serial runner), `firebase.json` (emulator config), the root `package.json`, `pnpm-lock.yaml`, and the `pnpm-workspace.yaml` catalog, so narrow `examples/**`-only filters would miss real regressions. Triggers therefore include packages, examples, scripts, root manifests, lockfile, workspace catalog, emulator config, and the e2e/workflow files themselves. Playwright browser binaries are **cached keyed on the resolved Playwright version** so the cache restores the actual browser artifact; Chromium-only for MVP.
5454

5555
---
5656

developer-docs/documentation-policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Applies to all durable documentation in this repository: the [developer-docs](in
3333
| Hard-to-reverse decisions | `developer-docs/decisions.md` |
3434
| Step-by-step procedures | `developer-docs/playbooks/` or root guides (pick one owner) |
3535
| Implementation backlogs | `developer-docs/work-queues/` |
36-
| Contributor onboarding | [CONTRIBUTING.md](../../CONTRIBUTING.md) |
37-
| Local dev commands | [LOCAL_DEVELOPMENT.md](../../LOCAL_DEVELOPMENT.md) |
36+
| Contributor onboarding | [CONTRIBUTING.md](../CONTRIBUTING.md) |
37+
| Local dev commands | [LOCAL_DEVELOPMENT.md](../LOCAL_DEVELOPMENT.md) |
3838
| Agent ephemeral output | `.agents/reports/` (gitignored) |
3939

4040
# Citations

0 commit comments

Comments
 (0)