Phase 3.7: paid pairing flow + returning chat + extension flip
- Backend: payment_sessions + pairing_failures tables; payment.service.js and pairing-failure.service.js (new); rewritten pairing.service.js (payment-gated blast + targeted "Curhat lagi" + cancel + fallback); rewritten extension.service.js (data-driven auto-approve with offline safeguard, charge-at-approval); pricing.service.js (extension tiers without free trial); mitra-status.service.js (countAvailableMitras cached path); 60s sweeper for stale payment sessions - Backend routes: client.payment.routes, client.mitra-availability.routes, internal/failed-pairings.routes; client.chat.routes rewritten for payment-gated start + /returning + /cancel + /fallback-to-blast; internal/config.routes adds 4 new keys with Valkey invalidate publish - client_app: mitra-availability poll, payment screen + notifier, pairing notifier rewrite (PairingTargetedWaiting + PairingFailed states), targeted-waiting overlay + bestie-unavailable dialog, "Curhat lagi" CTA, failed-pairing terminal, extension via payment-session - mitra_app: PairingRequestType enum, returning-chat 20s countdown auto-dismiss, extension card "otomatis disetujui" copy - control_center: 4 new config rows in Settings, Failed Pairings page (filter + paginate + action menu), sidebar + route registered - Test infrastructure: Vitest backend (7/7 pass), Playwright CC (4/4 pass), Maestro mobile scaffold (CLI install pending) - Bugs found via Playwright + fixed: LoginPage labels not associated with inputs (a11y); backend internal CORS missing PATCH/PUT/DELETE in allow-methods (silent settings breakage in browsers since Stage 4) - Docs: phase3.7.md PRD, phase3.7-plan.md, phase3.7-questions.md (Q&A), phase3.7-testing.md (E2E checklist), phase3.7-test-run-2026-05-03.md (today's run results) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
72
control_center/playwright.config.js
Normal file
72
control_center/playwright.config.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
// Load `.env` so operators can put CC_TEST_EMAIL / CC_TEST_PASSWORD /
|
||||
// CC_BASE_URL / BACKEND_INTERNAL_URL there instead of remembering to export
|
||||
// them in every shell. CLI env vars still win — dotenv does not override
|
||||
// already-set process.env values.
|
||||
dotenv.config()
|
||||
|
||||
/**
|
||||
* Playwright configuration for the Halo Bestie Control Center.
|
||||
*
|
||||
* Cross-machine flexibility is the priority: nothing here is hardcoded to a
|
||||
* specific host. The operator (or CI) starts the CC dev server + backend
|
||||
* separately and points these env vars at wherever they're reachable.
|
||||
*
|
||||
* Required env vars (with sensible local defaults):
|
||||
* CC_BASE_URL — where the CC SPA is served (default: http://localhost:5173)
|
||||
* BACKEND_INTERNAL_URL — where the internal Fastify listener is served
|
||||
* (default: http://localhost:3001) — used by helpers,
|
||||
* not by Playwright directly.
|
||||
* CC_TEST_EMAIL — control-center user email (default: placeholder)
|
||||
* CC_TEST_PASSWORD — control-center user password (default: placeholder)
|
||||
*
|
||||
* Optional toggles:
|
||||
* HEADED=1 — run with a visible browser (also: --headed CLI flag)
|
||||
* RECORD=1 — record video for every test (default: off)
|
||||
* PWDEBUG=1 — Playwright's built-in inspector
|
||||
*
|
||||
* NOTE: There is intentionally no `webServer` block — we never auto-start
|
||||
* the CC dev server. The operator controls when/where it runs so the same
|
||||
* Playwright suite can target a remote dev server on another machine.
|
||||
*/
|
||||
|
||||
const CC_BASE_URL = process.env.CC_BASE_URL || 'http://localhost:5173'
|
||||
const RECORD_VIDEO = process.env.RECORD === '1'
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './tests/e2e',
|
||||
outputDir: './test-results',
|
||||
timeout: 30_000,
|
||||
expect: { timeout: 5_000 },
|
||||
|
||||
// CC tests touch shared backend state (config rows, fixtures) — keep
|
||||
// serial by default to avoid flakes from parallel mutation.
|
||||
workers: 1,
|
||||
fullyParallel: false,
|
||||
|
||||
reporter: [
|
||||
['list'],
|
||||
['html', { outputFolder: 'playwright-report', open: 'never' }],
|
||||
],
|
||||
|
||||
use: {
|
||||
baseURL: CC_BASE_URL,
|
||||
trace: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
video: RECORD_VIDEO ? 'on' : 'off',
|
||||
actionTimeout: 10_000,
|
||||
navigationTimeout: 15_000,
|
||||
},
|
||||
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
// To add firefox/webkit later:
|
||||
// 1. npx playwright install firefox webkit
|
||||
// 2. Add { name: 'firefox', use: { ...devices['Desktop Firefox'] } } here
|
||||
],
|
||||
})
|
||||
Reference in New Issue
Block a user