Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(e2e): wire Profile UI recovery runner

Josuéb85be7a1ac95
diff --git a/Makefile b/Makefile
index b74d68007..718643243 100644
--- a/Makefile
+++ b/Makefile
@@ -1507,6 +1507,11 @@ test-playwright-desktop: ## Run Playwright tests for Desktop App only (requires:
@echo "Running Playwright Desktop App tests..."
cd tests/e2e/playwright && npx playwright test --project=desktop
+.PHONY: test-playwright-profile-ui-recovery
+test-playwright-profile-ui-recovery: ## Audit and run the Profile UI password-recovery browser journey
+ @python3 tools/e2e_static_audit.py tests/e2e/playwright/profile-ui-recovery/reset-session-hydration.spec.ts
+ @cd tests/e2e/playwright && node run-profile-ui-recovery.mjs
+
.PHONY: test-playwright-headed
test-playwright-headed: ## Run Control UI Playwright tests in headed mode (visible browser)
cd tests/e2e/playwright && npx playwright test --project=control-ui --headed
diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.json
index a30a3bb9c..59ac514a0 100644
--- a/tests/e2e/playwright/package-lock.json
+++ b/tests/e2e/playwright/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.70",
+ "version": "0.1.71",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-playwright-tests",
- "version": "0.1.70",
+ "version": "0.1.71",
"devDependencies": {
"@playwright/test": "^1.50.0",
"@types/node": "^22.0.0",
diff --git a/tests/e2e/playwright/package.json b/tests/e2e/playwright/package.json
index e67cd5fb0..07189128b 100644
--- a/tests/e2e/playwright/package.json
+++ b/tests/e2e/playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.70",
+ "version": "0.1.71",
"private": true,
"description": "Playwright E2E tests for Control UI and Desktop App",
"scripts": {
diff --git a/tests/e2e/playwright/profile-ui-recovery.config.ts b/tests/e2e/playwright/profile-ui-recovery.config.ts
index af27ebf5a..fbcb00494 100644
--- a/tests/e2e/playwright/profile-ui-recovery.config.ts
+++ b/tests/e2e/playwright/profile-ui-recovery.config.ts
@@ -3,11 +3,6 @@ import path from 'node:path'
const port = Number(process.env.PROFILE_UI_RECOVERY_PORT || 31873)
const baseURL = `http://127.0.0.1:${port}`
-const scratchRoot = process.env.CODEX_SCRATCH_ROOT
-
-if (!scratchRoot) {
- throw new Error('CODEX_SCRATCH_ROOT is required for Profile UI recovery browser artifacts')
-}
export default defineConfig({
testDir: path.join(__dirname, 'profile-ui-recovery'),
@@ -17,7 +12,7 @@ export default defineConfig({
workers: 1,
retries: 0,
reporter: [['list']],
- outputDir: path.join(scratchRoot, 'evenfire', 'pr1056-profile-ui-recovery-results'),
+ outputDir: path.join(__dirname, 'test-results', 'profile-ui-recovery'),
use: {
...devices['Desktop Chrome'],
baseURL,
diff --git a/tests/e2e/playwright/run-profile-ui-recovery.mjs b/tests/e2e/playwright/run-profile-ui-recovery.mjs
new file mode 100644
index 000000000..a9e8af3cf
--- /dev/null
+++ b/tests/e2e/playwright/run-profile-ui-recovery.mjs
@@ -0,0 +1,36 @@
+import { spawnSync } from 'node:child_process'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const scriptDirectory = path.dirname(fileURLToPath(import.meta.url))
+const config = path.join(scriptDirectory, 'profile-ui-recovery.config.ts')
+const playwrightCli = path.join(scriptDirectory, 'node_modules/@playwright/test/cli.js')
+
+function runPlaywright(args) {
+ return spawnSync(process.execPath, [playwrightCli, 'test', '--config', config, ...args], {
+ cwd: scriptDirectory,
+ encoding: 'utf8',
+ env: process.env,
+ })
+}
+
+const listing = runPlaywright(['--list', '--reporter=line'])
+const listingOutput = `${listing.stdout || ''}${listing.stderr || ''}`
+process.stdout.write(listingOutput)
+if (listing.error) throw listing.error
+if (listing.status !== 0) process.exit(listing.status || 1)
+if (!listingOutput.includes('reset-session-hydration.spec.ts')) {
+ throw new Error('Profile UI recovery runner did not collect the recovery spec')
+}
+if (!/Total:\s*[1-9]\d* tests?\b/.test(listingOutput)) {
+ throw new Error('Profile UI recovery runner collected zero tests')
+}
+
+const run = runPlaywright(['--reporter=line'])
+const runOutput = `${run.stdout || ''}${run.stderr || ''}`
+process.stdout.write(runOutput)
+if (run.error) throw run.error
+if (run.status !== 0) process.exit(run.status || 1)
+if (!/[1-9]\d* passed/.test(runOutput)) {
+ throw new Error('Profile UI recovery runner did not report a passing test')
+}