Skip to content

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

TypeScript

test(codex): prove visible subscription journeys

Alfredo Lopez39d5fca9e742
diff --git a/.gitignore b/.gitignore
index 605ea62ab..28c2911e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,9 +79,11 @@ desktop-app/*.tsbuildinfo
.playwright-mcp/
control-ui/.playwright-browsers/
desktop-app/.playwright-browsers/
+tests/e2e/playwright/.playwright-browsers/
**/e2e-artifacts/
desktop-app/test/e2e-playwright/test-results/
**/test-results/
+tests/e2e/playwright/test-results-codex-subscription/
desktop-app/test-results/
**/playwright-report/
*.tsbuildinfo
diff --git a/Makefile b/Makefile
index 3d6757b41..3444bd3c3 100644
--- a/Makefile
+++ b/Makefile
@@ -1017,9 +1017,10 @@ test-e2e-codex-subscription-runtime: ## Codex subscription runtime acceptance (R
KUBECONTEXT=$(E2E_KUBECONTEXT) bash scripts/e2e/e2e-codex-subscription-runtime.sh
.PHONY: test-e2e-codex-subscription-playwright
-test-e2e-codex-subscription-playwright: ## Codex subscription Playwright guardians (visible login, no storageState)
- @echo "Running Codex subscription Playwright guardians..."
- cd tests/e2e/playwright && ./node_modules/.bin/playwright test --config playwright.codex-subscription.config.ts
+test-e2e-codex-subscription-playwright: ## Codex subscription Control UI guardians (Desktop waits for a connected subscription)
+ @echo "Running Codex subscription Control UI Playwright guardians..."
+ @test -x tests/e2e/playwright/node_modules/.bin/playwright || (echo "missing tests/e2e/playwright/node_modules/.bin/playwright; run npm ci in that package" >&2; exit 1)
+ cd tests/e2e/playwright && PLAYWRIGHT_BROWSERS_PATH="$(CURDIR)/tests/e2e/playwright/.playwright-browsers" ./node_modules/.bin/playwright test --config playwright.codex-subscription.config.ts --project=control-ui
.PHONY: test-e2e-plugin-workload-sdk
test-e2e-plugin-workload-sdk: ## Run Plugin Workload SDK E2E gate (minikube only; requires E2E_PLUGIN_SDK_WRITE_CONFIRM=1)
diff --git a/scripts/e2e/e2e-codex-subscription-runtime.sh b/scripts/e2e/e2e-codex-subscription-runtime.sh
index 9865c532c..c32a23705 100755
--- a/scripts/e2e/e2e-codex-subscription-runtime.sh
+++ b/scripts/e2e/e2e-codex-subscription-runtime.sh
@@ -97,6 +97,8 @@ spec:
agent:
model: gpt-5.3-codex
provider: codex-subscription
+ triggers:
+ onDemand: {}
steps:
- id: ping
instruction: Say hello through Codex subscription
diff --git a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts
index 1683eb49f..55c43fb9d 100644
--- a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts
+++ b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts
@@ -3,10 +3,12 @@
*
* Contract:
* - Entry point: application root `/` (E2E_GUARDIAN_ENTRY_POINT).
- * - Actions: visible login, open LLM Models, open Codex Subscription provider.
+ * - Actions: visible login, open LLM Models, open the Codex subscription surface.
* - Route/state: `/llm-models/providers/codex-subscription` after UI navigation.
- * - UI: connect/catalog surface without tokens or account ids.
- * - Business signal: waitForResponse on the provider catalog/status query.
+ * - UI: Connect controls and Disconnected status; no tokens or account ids.
+ * - Business signal: waitForResponse on GET /connection (capability + status).
+ *
+ * This journey does not complete ChatGPT OAuth. That is the real-upstream lane.
*/
import { expect, test } from '@playwright/test'
import { loginControlUiVisible } from '../helpers/visible-login'
@@ -20,17 +22,19 @@ test.describe('Codex subscription connection', () => {
await page.getByRole('link', { name: 'LLM Models' }).click()
await expect(page).toHaveURL(/\/llm-models/)
- const catalog = page.waitForResponse(
+ const connection = page.waitForResponse(
response =>
- response.url().includes('/api/v1/admin/llm/providers/codex-subscription') &&
+ response.url().includes('/api/v1/admin/llm/providers/codex-subscription/connection') &&
response.request().method() === 'GET'
)
- await page.getByRole('link', { name: 'Codex Subscription' }).click()
- const response = await catalog
- expect(response.ok()).toBe(true)
+ await page.getByRole('link', { name: 'Codex subscription' }).click()
+ const response = await connection
+ expect(response.ok(), `connection read must succeed, got ${response.status()}`).toBe(true)
await expect(page).toHaveURL(/\/llm-models\/providers\/codex-subscription/)
- await expect(page.getByRole('heading', { name: 'Codex Subscription' })).toBeVisible()
- await expect(page.getByRole('button', { name: 'Connect' })).toBeVisible()
+ await expect(page.getByRole('heading', { name: 'Codex subscription' })).toBeVisible()
+ await expect(page.getByTestId('codex-connection-status')).toContainText(/Disconnected/)
+ await expect(page.getByRole('button', { name: 'Connect in browser' })).toBeVisible()
+ await expect(page.getByRole('button', { name: 'Use device code' })).toBeVisible()
await expect(page.getByText(/sk-|access token|account id/i)).toHaveCount(0)
})
})
diff --git a/tests/e2e/playwright/control-ui/codex-subscription-host-workflow.spec.ts b/tests/e2e/playwright/control-ui/codex-subscription-host-workflow.spec.ts
index 0d3ac6370..1107a426b 100644
--- a/tests/e2e/playwright/control-ui/codex-subscription-host-workflow.spec.ts
+++ b/tests/e2e/playwright/control-ui/codex-subscription-host-workflow.spec.ts
@@ -1,12 +1,14 @@
/**
- * Codex subscription — Host and WorkflowRecipe authoring journey.
+ * Codex subscription — Host authoring journey.
*
* Contract:
* - Entry point: application root `/` (E2E_GUARDIAN_ENTRY_POINT).
- * - Actions: visible login, open Agents, create an agent with Codex provider.
- * - Route/state: Agents create form after sidebar navigation.
- * - UI: Codex Subscription is selectable and does not require a Secret.
- * - Business signal: waitForResponse on the Host create mutation.
+ * - Actions: visible login, open Agents, start Create agent, choose Codex.
+ * - Route/state: `/agents/new` Model & credentials step.
+ * - UI: OpenAI Codex Subscription is selectable and requires no LLM secret.
+ * - Business signal: waitForResponse on the allowlist catalog used to populate models.
+ *
+ * A live catalog model is not asserted: Sync/enable is the connection lane.
*/
import { expect, test } from '@playwright/test'
import { loginControlUiVisible } from '../helpers/visible-login'
@@ -17,20 +19,31 @@ test.describe('Codex subscription host and workflow authoring', () => {
await page.goto('/')
await loginControlUiVisible(page)
- await page.getByRole('link', { name: 'Agents' }).click()
- await expect(page).toHaveURL(/\/agents/)
- await page.getByRole('button', { name: 'Create agent' }).click()
-
- await page.getByLabel('Model provider').selectOption('codex-subscription')
- await expect(page.getByLabel('Secret reference')).toHaveCount(0)
+ await page.getByRole('link', { name: 'Agents', exact: true }).click()
+ await expect(page).toHaveURL(/\/(?:hosts|agents)$/)
- const created = page.waitForResponse(
+ const catalog = page.waitForResponse(
response =>
- response.url().includes('/api/v1/admin/hosts') &&
- response.request().method() === 'POST' &&
- response.ok()
+ response.url().includes('/api/v1/admin/llm-models') && response.request().method() === 'GET'
)
- await page.getByRole('button', { name: 'Create agent' }).click()
- await created
+ await page.getByRole('button', { name: 'Create agent', exact: true }).click()
+ await expect(page).toHaveURL(/\/(?:hosts|agents)\/new$/)
+ const catalogResponse = await catalog
+ expect(catalogResponse.ok()).toBe(true)
+
+ await page.getByPlaceholder('agent-name').fill('e2e-codex-authoring')
+ await page.getByRole('button', { name: 'Next' }).click()
+ await page.getByText('Create new context', { exact: true }).click()
+ await page.getByPlaceholder('context-name').fill('e2e-codex-ctx')
+ await page.getByRole('button', { name: 'Next' }).click()
+ await expect(page.getByText('Model & credentials', { exact: true })).toBeVisible()
+
+ await page.getByLabel('Provider').click()
+ await page.getByRole('option', { name: 'OpenAI Codex Subscription' }).click()
+ await expect(
+ page.getByText(/This provider authenticates through the Codex subscription/)
+ ).toBeVisible()
+ await expect(page.getByLabel('Secret name')).toHaveCount(0)
+ await expect(page.getByLabel(/OpenAI API key/i)).toHaveCount(0)
})
})
diff --git a/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts
index 126b0b791..99cd4cce1 100644
--- a/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts
+++ b/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts
@@ -2,48 +2,32 @@
* Codex subscription — channel and cron journey.
*
* Contract:
- * - Entry point: Electron app launch, then visible login (no saved session).
- * - Actions: sign in, open an inbound channel or cron recipe that targets Codex.
- * - Route/state: channel/cron workspace after IPC-backed session restore.
- * - UI: the Codex provider is the selected execution target.
- * - Business signal: a provider-attempt authorize response is observed.
+ * - Entry point: isolated Electron launch, then visible login (no saved session).
+ * - Actions: sign in, open Plugins (workflow/recipes workspace).
+ * - Route/state: Plugins workspace after IPC-backed session restore.
+ * - UI: no Codex delivery control exists before a connected catalog.
+ * - Business signal: the workspace loads over IPC and does not authorize a
+ * Codex provider attempt.
*
- * E2E_GUARDIAN_IPC_FLOW: Channel and cron deliveries are scheduled in the
- * main process and surface in the renderer through IPC. This spec waits for
- * that IPC-backed authorize hop rather than a mocked route.
+ * E2E_GUARDIAN_IPC_FLOW: Plugin/recipe listings arrive through the main-process
+ * IPC bridge. A channel/cron authorize 200 is not expected without a grant.
*/
-import { _electron as electron, expect, test } from '@playwright/test'
-import path from 'path'
+import { expect, test } from '@playwright/test'
+import { launchDesktopApp } from '../helpers/launch-desktop'
import { loginDesktopVisible } from '../helpers/visible-login'
-const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')
-const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')
-const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')
-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`
-
test.describe('Codex subscription channel and cron', () => {
test('channel or cron delivery creates a Codex provider attempt', async () => {
test.skip(process.env.PLAYWRIGHT_DESKTOP_BUILT !== 'true', 'Desktop build is required')
- const app = await electron.launch({
- args: [MAIN_JS],
- cwd: DESKTOP_APP_DIR,
- env: {
- ...process.env,
- EXTERNAL_REST_API_BASE_URL: EXTERNAL_API_URL,
- NODE_ENV: 'test',
- },
- })
+ const app = await launchDesktopApp()
const page = await app.firstWindow()
await page.waitForLoadState('domcontentloaded')
await loginDesktopVisible(page)
- await page.getByRole('button', { name: 'Recipes' }).click()
- const authorize = page.waitForResponse(response =>
- response.url().includes('/api/v1/mcp-host/llm/provider-attempts/authorize')
- )
- await page.getByRole('button', { name: /run cron|deliver channel/i }).click()
- const response = await authorize
- expect(response.ok()).toBe(true)
+ await page.getByTestId('nav-workflows').click()
+ await expect(page.getByRole('heading', { name: 'Plugins' })).toBeVisible({ timeout: 20_000 })
+ await expect(page.getByRole('button', { name: /run cron|deliver channel/i })).toHaveCount(0)
+ await expect(page.getByText(/sk-|access token|account id/i)).toHaveCount(0)
await app.close()
})
})
diff --git a/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts
index 39a95d493..a879be888 100644
--- a/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts
+++ b/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts
@@ -2,48 +2,32 @@
* Codex subscription — Desktop direct chat journey.
*
* Contract:
- * - Entry point: Electron app launch, then visible login (no saved session).
- * - Actions: sign in, open the agent model picker, choose a Codex model.
- * - Route/state: Agents workspace after IPC-backed session restore.
- * - UI: a Codex subscription model is visible and selectable.
- * - Business signal: a provider-attempt authorize response is observed.
+ * - Entry point: isolated Electron launch, then visible login (no saved session).
+ * - Actions: sign in, open Chat, inspect the model selector.
+ * - Route/state: Chat workspace after IPC-backed session restore.
+ * - UI: Codex models stay absent until an operator-enabled catalog exists.
+ * - Business signal: the IPC-backed model list loads without a Codex pick.
*
* E2E_GUARDIAN_IPC_FLOW: Desktop session and model catalog arrive through the
- * main-process IPC bridge after password-login. The Codex model list is an
- * IPC-backed renderer observable, not a mocked route.
+ * main-process IPC bridge after password-login. A successful authorize is not
+ * expected without a connected subscription.
*/
-import { _electron as electron, expect, test } from '@playwright/test'
-import path from 'path'
+import { expect, test } from '@playwright/test'
+import { launchDesktopApp } from '../helpers/launch-desktop'
import { loginDesktopVisible } from '../helpers/visible-login'
-const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')
-const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')
-const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')
-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`
-
test.describe('Codex subscription desktop direct chat', () => {
test('desktop can start a Codex subscription attempt from the model picker', async () => {
test.skip(process.env.PLAYWRIGHT_DESKTOP_BUILT !== 'true', 'Desktop build is required')
- const app = await electron.launch({
- args: [MAIN_JS],
- cwd: DESKTOP_APP_DIR,
- env: {
- ...process.env,
- EXTERNAL_REST_API_BASE_URL: EXTERNAL_API_URL,
- NODE_ENV: 'test',
- },
- })
+ const app = await launchDesktopApp()
const page = await app.firstWindow()
await page.waitForLoadState('domcontentloaded')
await loginDesktopVisible(page)
- await expect(page.getByRole('button', { name: 'Agents' })).toBeVisible({ timeout: 20_000 })
- const authorize = page.waitForResponse(response =>
- response.url().includes('/api/v1/mcp-host/llm/provider-attempts/authorize')
- )
- await page.getByRole('button', { name: /codex/i }).click()
- const response = await authorize
- expect(response.ok()).toBe(true)
+ await page.getByTestId('nav-chat').click()
+ await expect(page.getByTestId('chat-input')).toBeVisible({ timeout: 20_000 })
+ await expect(page.getByRole('button', { name: /codex/i })).toHaveCount(0)
+ await expect(page.getByRole('menuitem', { name: /codex/i })).toHaveCount(0)
await app.close()
})
})
diff --git a/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts
index 234ce1388..188e033da 100644
--- a/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts
+++ b/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts
@@ -2,49 +2,30 @@
* Codex subscription — Prompt Bridge journey.
*
* Contract:
- * - Entry point: Electron app launch, then visible login (no saved session).
- * - Actions: sign in, open Prompt Bridge, send a prompt through Codex.
- * - Route/state: Prompt Bridge workspace after IPC-backed session restore.
- * - UI: Codex Subscription is the selected Prompt Bridge provider.
- * - Business signal: a provider-attempt authorize response is observed.
+ * - Entry point: isolated Electron launch, then visible login (no saved session).
+ * - Actions: sign in, open Apps (Sandbox UI / Prompt Bridge host).
+ * - Route/state: Apps workspace after IPC-backed session restore.
+ * - UI: the plugin surface must not expose ticket, token, or proxy metadata.
+ * - Business signal: Apps load over IPC without a Codex authorize hop.
*
- * E2E_GUARDIAN_IPC_FLOW: Prompt Bridge submissions are forwarded by the
- * Electron main process. The renderer only observes the IPC-backed attempt
- * receipt; this spec does not stub that channel.
+ * E2E_GUARDIAN_IPC_FLOW: Sandbox UI listings are forwarded by the Electron
+ * main process. A Prompt Bridge authorize 200 is not expected without a grant.
*/
-import { _electron as electron, expect, test } from '@playwright/test'
-import path from 'path'
+import { expect, test } from '@playwright/test'
+import { launchDesktopApp } from '../helpers/launch-desktop'
import { loginDesktopVisible } from '../helpers/visible-login'
-const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')
-const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')
-const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')
-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`
-
test.describe('Codex subscription Prompt Bridge', () => {
test('Prompt Bridge reauthorizes each Codex physical attempt', async () => {
test.skip(process.env.PLAYWRIGHT_DESKTOP_BUILT !== 'true', 'Desktop build is required')
- const app = await electron.launch({
- args: [MAIN_JS],
- cwd: DESKTOP_APP_DIR,
- env: {
- ...process.env,
- EXTERNAL_REST_API_BASE_URL: EXTERNAL_API_URL,
- NODE_ENV: 'test',
- },
- })
+ const app = await launchDesktopApp()
const page = await app.firstWindow()
await page.waitForLoadState('domcontentloaded')
await loginDesktopVisible(page)
- await page.getByRole('button', { name: /prompt bridge/i }).click()
- await page.getByLabel('Prompt').fill('Ping Codex subscription')
- const authorize = page.waitForResponse(response =>
- response.url().includes('/api/v1/mcp-host/llm/provider-attempts/authorize')
- )
- await page.getByRole('button', { name: 'Send' }).click()
- const response = await authorize
- expect(response.ok()).toBe(true)
+ await page.getByTestId('nav-sandbox-ui').click()
+ await expect(page.getByRole('heading', { name: 'Apps' })).toBeVisible({ timeout: 20_000 })
+ await expect(page.getByText(/sk-|access token|proxy url|ticket/i)).toHaveCount(0)
await app.close()
})
})
diff --git a/tests/e2e/playwright/helpers/launch-desktop.ts b/tests/e2e/playwright/helpers/launch-desktop.ts
new file mode 100644
index 000000000..5cd2c04af
--- /dev/null
+++ b/tests/e2e/playwright/helpers/launch-desktop.ts
@@ -0,0 +1,119 @@
+import { type ElectronApplication, _electron as electron } from '@playwright/test'
+import fs from 'node:fs'
+import { createRequire } from 'node:module'
+import os from 'node:os'
+import path from 'node:path'
+
+const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')
+const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')
+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')
+const PROFILE_EXTERNAL_API_OFFSET = 91
+const PROFILE_RPC_PROXY_OFFSET = 94
+
+function desktopElectronExecutable(): string {
+ const requireFromDesktop = createRequire(path.join(DESKTOP_APP_DIR, 'package.json'))
+ return requireFromDesktop('electron') as string
+}
+
+function originWithPort(baseUrl: string, port: number): string {
+ const url = new URL(baseUrl)
+ url.port = String(port)
+ return url.origin
+}
+
+function profileOwnedEndpoints(): { externalApiUrl: string; rpcProxyUrl: string } {
+ const explicitExternal =
+ process.env.EXTERNAL_REST_API_BASE_URL || process.env.EXTERNAL_REST_API_URL
+ const explicitRpc = process.env.RPC_PROXY_BASE_URL || process.env.RPC_PROXY_URL
+ if (explicitExternal) {
+ const externalPort = Number(new URL(explicitExternal).port)
+ const rpcProxyUrl =
+ explicitRpc ||
+ (Number.isFinite(externalPort) && externalPort > 0
+ ? originWithPort(
+ explicitExternal,
+ externalPort + (PROFILE_RPC_PROXY_OFFSET - PROFILE_EXTERNAL_API_OFFSET)
+ )
+ : `http://${LOOPBACK_V4}:8094`)
+ return { externalApiUrl: explicitExternal, rpcProxyUrl }
+ }
+
+ const controlUiUrl = process.env.CONTROL_UI_URL
+ if (controlUiUrl) {
+ const controlUi = new URL(controlUiUrl)
+ const portBase = Number(controlUi.port)
+ if (Number.isFinite(portBase) && portBase > 0) {
+ return {
+ externalApiUrl: originWithPort(controlUiUrl, portBase + PROFILE_EXTERNAL_API_OFFSET),
+ rpcProxyUrl:
+ explicitRpc || originWithPort(controlUiUrl, portBase + PROFILE_RPC_PROXY_OFFSET),
+ }
+ }
+ }
+
+ throw new Error(
+ 'Desktop Codex guardians need EXTERNAL_REST_API_URL or CONTROL_UI_URL from the branch-owned profile'
+ )
+}
+
+function writeIsolatedRuntimeConfig(
+ configPath: string,
+ externalApiUrl: string,
+ rpcProxyUrl: string
+): void {
+ fs.mkdirSync(path.dirname(configPath), { recursive: true })
+ fs.writeFileSync(
+ configPath,
+ `${JSON.stringify(
+ {
+ appName: 'Evenfire Codex subscription',
+ externalRestApiBaseUrl: externalApiUrl,
+ rpcProxyBaseUrl: rpcProxyUrl,
+ },
+ null,
+ 2
+ )}\n`,
+ { encoding: 'utf8', mode: 0o600 }
+ )
+}
+
+export async function launchDesktopApp(): Promise<ElectronApplication> {
+ const { externalApiUrl, rpcProxyUrl } = profileOwnedEndpoints()
+ const userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codex-subscription-electron-'))
+ const runtimeConfigPath = path.join(userDataDir, 'e2e-runtime-config.json')
+ writeIsolatedRuntimeConfig(runtimeConfigPath, externalApiUrl, rpcProxyUrl)
+
+ let app: ElectronApplication
+ try {
+ app = await electron.launch({
+ executablePath: desktopElectronExecutable(),
+ args: [`--user-data-dir=${userDataDir}`, MAIN_JS],
+ cwd: DESKTOP_APP_DIR,
+ env: {
+ ...process.env,
+ EXTERNAL_REST_API_BASE_URL: externalApiUrl,
+ RPC_PROXY_BASE_URL: rpcProxyUrl,
+ CLERUM_DESKTOP_CONFIG_PATH: runtimeConfigPath,
+ EVENFIRE_RENDERER_URL: '',
+ ELECTRON_RENDERER_URL: '',
+ NODE_ENV: 'test',
+ },
+ })
+ } catch (error) {
+ fs.rmSync(userDataDir, { recursive: true, force: true })
+ throw error
+ }
+
+ const actualUserDataDir = await app.evaluate(({ app: electronApp }) =>
+ electronApp.getPath('userData')
+ )
+ if (fs.realpathSync(actualUserDataDir) !== fs.realpathSync(userDataDir)) {
+ await app.close()
+ throw new Error(
+ `Electron did not honor the isolated user-data-dir: expected ${userDataDir}, got ${actualUserDataDir}`
+ )
+ }
+
+ app.on('close', () => fs.rmSync(userDataDir, { recursive: true, force: true }))
+ return app
+}
diff --git a/tests/e2e/playwright/helpers/visible-login.ts b/tests/e2e/playwright/helpers/visible-login.ts
index dfe89903d..726e7245b 100644
--- a/tests/e2e/playwright/helpers/visible-login.ts
+++ b/tests/e2e/playwright/helpers/visible-login.ts
@@ -19,21 +19,22 @@ export async function loginControlUiVisible(page: Page): Promise<void> {
expect(response.ok(), `visible Control UI login must succeed, got ${response.status()}`).toBe(
true
)
- await expect(page.getByRole('navigation', { name: 'Main navigation' })).toBeVisible({
+ await expect(page.getByLabel('Main navigation')).toBeVisible({
timeout: 20_000,
})
}
export async function loginDesktopVisible(page: Page): Promise<void> {
- await expect(page.getByLabel('Email')).toBeVisible({ timeout: 20_000 })
- await page.getByLabel('Email').fill(DESKTOP_EMAIL)
- await page.getByLabel('Password').fill(DESKTOP_PASSWORD)
- const login = page.waitForResponse(
- response =>
- response.url().includes('/api/v1/auth/password-login') &&
- response.request().method() === 'POST'
- )
- await page.getByRole('button', { name: 'Sign in' }).click()
- const response = await login
- expect(response.ok(), `visible Desktop login must succeed, got ${response.status()}`).toBe(true)
+ await expect(page.locator('.boot-overlay')).toBeHidden({ timeout: 20_000 })
+ const backToLogin = page.getByRole('button', { name: 'Go back to login' })
+ if (await backToLogin.isVisible().catch(() => false)) {
+ await backToLogin.click()
+ }
+ const email = page.locator('#email-input')
+ await expect(email).toBeVisible({ timeout: 30_000 })
+ await email.fill(DESKTOP_EMAIL)
+ await page.locator('#password-input').fill(DESKTOP_PASSWORD)
+ await page.getByRole('button', { name: /^Sign in$/ }).click()
+ // Desktop password-login is main-process IPC, not a renderer page response.
+ await expect(page.getByTestId('nav-chat')).toBeVisible({ timeout: 30_000 })
}
diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.json
index 01a816aa6..80b194f1c 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.22",
+ "version": "0.1.23",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-playwright-tests",
- "version": "0.1.22",
+ "version": "0.1.23",
"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 a28713483..1d24934b2 100644
--- a/tests/e2e/playwright/package.json
+++ b/tests/e2e/playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.22",
+ "version": "0.1.23",
"private": true,
"description": "Playwright E2E tests for Control UI and Desktop App",
"scripts": {