2.23 Playwright QA Pipeline — What Is Actually Enforced
Playwright is a robot that tests your website by actually clicking buttons, filling forms, and checking if everything works — just like a human would. Instead of manually clicking through your app after every code change, Playwright does it automatically in seconds, catching bugs before they reach production.
Playwright is a robot that tests your website by actually clicking buttons, filling forms, and checking if everything works — just like a human would. Instead of manually clicking through your app after every code change, Playwright does it automatically in seconds, catching bugs before they reach production.
End-to-end browser automation testing with Playwright — what is implemented on main today, what is aspirational, and how the Universal Inbox smoke gates work.
e2e/inbox-smoke.spec.ts (3 API gates).github/workflows/inbox-smoke.ymlportal/scripts/inbox-prod-smoke.shSection A What Is Actually Enforced Today vs Aspirational
This page describes only what exists on main today. Anything not in the repo is marked TODO. No fake green. No promises of quality gates that are not wired into CI.
Playwright is Microsoft's modern browser automation framework. It controls real browsers (Chrome, Firefox, Safari) programmatically, clicking elements, typing text, and verifying behavior — exactly like a human tester would, but automated and fast.
What is actually enforced today (on main, commit b3bc0b76):
- One Playwright e2e spec —
03_technology/11_frontend/portal/e2e/inbox-smoke.spec.tswith 3 API-level gates (bulk label count, label filter parity, no internal threads in inbox). - One CI workflow —
.github/workflows/inbox-smoke.ymlthat runs vitest + the smoke script on every push tomaintouchingportal/**. - One smoke script —
03_technology/11_frontend/portal/scripts/inbox-prod-smoke.sh(vendored from~/.hermes/scripts/inbox-prod-smoke.sh) with 6 gates: SHA parity, critical files on main, DB label count, bulk API, list API, internal exclusion. - Package scripts —
npm run test:e2eandnpm run smoke:inboxinportal/package.json.
What is NOT enforced today (aspirational, marked TODO):
- Multi-browser CI matrix (Chromium + Firefox + WebKit) — only Chromium project is defined in
playwright.config.ts. - Authenticated Playwright runs in CI —
COOKIEenv var is commented out ininbox-smoke.yml; CI runs unauthenticated gates only. - Visual regression tests (
toHaveScreenshot()) — no screenshot specs exist ine2e/. - Login flow, dashboard, form submit e2e tests — no such spec files exist.
- Parallel sharded CI runs —
workers: 1in CI, no sharding configured.
The diagram above shows the ideal end-state (multi-browser, 50+ tests, visual regression, PR blocking). Only the “API Check” and “CI Trigger” boxes are implemented today. The rest is TODO.
What Is Aspirational?
The following capabilities are documented in this guide but are not yet implemented on main. They are marked TODO where they appear.
- Multi-browser CI matrix (Firefox, WebKit)
- Authenticated Playwright in CI (cookie-based)
- Visual regression / screenshot tests
- Login / dashboard / form e2e specs
- Parallel sharded CI runs
- HTML report upload as CI artifact
- Chromium-only Playwright config
- 3 API-level inbox smoke gates
- vitest label-engine unit tests
- inbox-prod-smoke.sh 6-gate script
- CI workflow on push to main
- Package scripts:
test:e2e,smoke:inbox
Section B Installation
Install Playwright in your Next.js or Node.js project:
# Install Playwright and browsers npm init playwright@latest # Or add to existing project npm install -D @playwright/test npx playwright install
The npx playwright install command downloads Chromium, Firefox, and WebKit (~500MB total). This is normal and required for local testing.
Writing Tests
Create a test file in tests/example.spec.ts:
import { test, expect } from '@playwright/test';
test('homepage loads and shows RAIA (Real estate Artificial Intelligence Agent) branding', async ({ page }) => {
// Navigate to homepage
await page.goto('https://portal.estateaigents.com');
// Check title
await expect(page).toHaveTitle(/RAIA/);
// Check logo is visible
await expect(page.locator('img[alt="RAIA (Real estate Artificial Intelligence Agent) Logo"]')).toBeVisible();
});
test('login flow with valid credentials', async ({ page }) => {
await page.goto('https://portal.estateaigents.com/login');
// Fill login form
await page.fill('input[name="email"]', 'test@example.com');
await page.fill('input[name="password"]', 'SecurePassword123');
await page.click('button[type="submit"]');
// Wait for redirect to dashboard
await expect(page).toHaveURL(/dashboard/);
await expect(page.locator('h1')).toContainText('Dashboard');
});
The example specs above (homepage branding, login flow) are illustrative. No such spec files exist in e2e/ today. The only real spec is e2e/inbox-smoke.spec.ts.
Running Tests
Execute tests locally or in CI:
# Run all tests (headless) npx playwright test # Run in headed mode (see browser) npx playwright test --headed # Run specific test file npx playwright test tests/login.spec.ts # Debug mode (pause execution) npx playwright test --debug # Generate HTML report npx playwright show-report
CI Integration
Add Playwright to GitHub Actions:
name: Playwright Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
The workflow above is the ideal template. The only CI workflow on main today is .github/workflows/inbox-smoke.yml, which runs vitest + the bash smoke script — not npx playwright test. Multi-browser matrix, PR triggers, and artifact upload are TODO.
Use npx playwright install --with-deps in CI to install system libraries (like libglib). Without --with-deps, browsers will fail to launch on fresh CI containers.
Section C Architecture
The diagram above shows the full Playwright capability set. Only Chromium is configured in e2e/playwright.config.ts today. Firefox and WebKit projects are TODO.
inbox-prod-smoke.sh Gates — What Is Actually Enforced
The Universal Inbox smoke script (portal/scripts/inbox-prod-smoke.sh, vendored from ~/.hermes/scripts/inbox-prod-smoke.sh) is the only production-integrity gate that runs today. It is executed by .github/workflows/inbox-smoke.yml on every push to main touching portal/**.
| Gate | What It Checks | Pass Condition | CI Status |
|---|---|---|---|
| Gate 0: SHA Parity | Production deployment SHA matches main tip |
PROD_SHA starts with or equals MAIN_SHA |
Active |
| Gate 1: Critical Files | chip-tokens.ts and Chip.tsx exist on origin/main |
git cat-file -e origin/main:<path> exits 0 |
Active |
| Gate 2: DB Label Count | Supabase tbl_conversation_labels Maintenance count matches bulk API |
Direct DB count extracted for comparison | Skipped in CI (no SUPABASE env) |
| Gate 3: Bulk API | /api/inbox/label/bulk?org_id=... returns 200 with Maintenance count |
HTTP 200 + labels.Maintenance ≥ 1 |
Skipped in CI (no COOKIE) |
| Gate 4: List API Parity | /api/inbox/conversations?label=Maintenance returns count matching bulk |
listCount == min(bulkCount, 200) |
Skipped in CI (no COOKIE) |
| Gate 5: Internal Exclusion | Default inbox list contains 0 conversation_type=internal threads |
internalCount == 0 |
Skipped in CI (no COOKIE) |
| Gate 6: vitest | label-engine.test.ts unit tests pass |
npx vitest run exits 0 |
Active (continue-on-error: true) |
| Gate 7: Playwright e2e | e2e/inbox-smoke.spec.ts passes (3 tests) |
npx playwright test exits 0 |
Not in CI (PLAYWRIGHT=1 not set) |
Set env vars and run the vendored script:
BASE_URL=https://app.estateaigents.com \ ORG_ID=\ COOKIE='your-staff-session-cookie' \ SUPABASE_SERVICE_ROLE_KEY='...' \ SUPABASE_URL='...' \ PLAYWRIGHT=1 \ bash 03_technology/11_frontend/portal/scripts/inbox-prod-smoke.sh
Exit 0 = all gates green. Exit 1 = at least one FAIL line printed.
Test Patterns
Follow these patterns for maintainable, reliable tests:
| Pattern | Bad Example | Good Example |
|---|---|---|
| Locators | page.locator('.btn-primary') |
page.locator('button[data-testid="submit"]') |
| Waits | await page.waitForTimeout(3000) |
await page.locator('#result').waitFor() |
| Assertions | if (await page.locator('#msg').isVisible()) |
await expect(page.locator('#msg')).toBeVisible() |
| Cleanup | Leave sessions hanging | Use test.afterEach to logout/clear storage |
Troubleshooting
If tests randomly fail with "element not found", you're clicking before the page finishes loading. Use await page.waitForLoadState('networkidle') or wait for specific elements instead of timeouts.
In CI, browser launch can timeout if system dependencies are missing. Always use npx playwright install --with-deps to install OS-level libraries.
Advanced Techniques
Page Object Model (POM) — encapsulate page interactions:
// pages/LoginPage.ts
export class LoginPage {
constructor(private page: Page) {}
async login(email: string, password: string) {
await this.page.fill('input[name="email"]', email);
await this.page.fill('input[name="password"]', password);
await this.page.click('button[type="submit"]');
}
}
// tests/login.spec.ts
import { LoginPage } from '../pages/LoginPage';
test('login with POM', async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.login('test@example.com', 'password123');
await expect(page).toHaveURL(/dashboard/);
});
Visual Regression Testing — catch UI changes:
test('homepage visual snapshot', async ({ page }) => {
await page.goto('https://portal.estateaigents.com');
await expect(page).toHaveScreenshot('homepage.png');
});
Never rely on production data in tests. Use test.beforeEach to seed a test database or use API mocks. Tests must be deterministic and repeatable.
POM and visual regression examples above are best-practice guidance. No POM classes or screenshot specs exist in e2e/ today.
References & External Sources
| Source | Relevance | Link |
|---|---|---|
| ADR-288 (pending) | Module rollout and provider integrations that will expand Playwright coverage | Not yet landed — tracked in portal/src/lib/compliance.ts stubs |
| inbox-prod-smoke.sh | Production integrity gate script (vendored in portal/scripts/) |
~/.hermes/scripts/inbox-prod-smoke.sh |
| estateaigents-docs-pipeline skill | Docs pipeline operation, repair, and verification procedures | ~/.hermes/profiles/scribe/skills/docs/estateaigents-docs-pipeline/ |
| dogfood skill | Exploratory QA and browser-based verification of live pages | ~/.hermes/profiles/scribe/skills/software-development/dogfood/ |