Skip to content

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

TypeScript

test(e2e): add agent-access playwright regression catalog for context removal

Miguelon Peluchon49394a20c5b5
diff --git a/docs/features/control-ui-context-removal.md b/docs/features/control-ui-context-removal.md
index b093511ed..42a774235 100644
--- a/docs/features/control-ui-context-removal.md
+++ b/docs/features/control-ui-context-removal.md
@@ -194,6 +194,28 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a
- RFC1123/displayName gating for generated private-context names → suite against `lib/agentContext.ts` (kept/extended for the generalized generator).
- **Playwright e2e** (`tests/e2e/playwright/control-ui/`): specs that walked the Contexts section are rewritten to the user-visible replacement path or deleted when the whole subject is gone (`contexts.spec.ts`). Selector constants updated.
- **QA-recorder specs** (`control-ui/e2e/qa-recorder-*.spec.ts`) + their `package.json` scripts: context-section journeys removed; connector/team journeys rewritten to agent-centric paths.
+- **New main-suite e2e regression catalog** (`tests/e2e/playwright/control-ui/`, built 2026-08-27) — 15 new specs + 1 extended, covering every §12 manual flow as automation:
+
+ | Spec | Covers (§12 flow) |
+ | --- | --- |
+ | `contexts.spec.ts` (extended) | A1–A5 incl. real private-slug → owning agent Connectors tab |
+ | `agents-connectors-hover.spec.ts` | B1–B2 |
+ | `agent-create-wizard.spec.ts` | B3 (rail labels + vocab; full creation stays in `qa-recorder-agent-create`) |
+ | `agent-connectors-tab.spec.ts` | B4 |
+ | `connectors-agent-access.spec.ts` | C1–C4 (incl. shared-scope confirm) |
+ | `connector-create-access-step.spec.ts` | C5–C6 |
+ | `connector-edit-access-tab.spec.ts` | C7–C9 |
+ | `marketplace-install-flow.spec.ts` | D1–D2 light (skips when no registry entries deployed; never clicks Install) |
+ | `member-access-tab.spec.ts` | E1–E3 (+ API round-trip verification, original mappings restored) |
+ | `team-access-tab.spec.ts` | E4 (+ legacy tab redirect) |
+ | `team-create-wizard.spec.ts` | E5 |
+ | `users-teams-access-column.spec.ts` | E6 |
+ | `agent-files-mounted-by.spec.ts` | F1–F2 (read-only; no PVC seeding) |
+ | `recipe-scope-copy.spec.ts` | G1–G2 |
+ | `token-budget-scope-label.spec.ts` | G3 |
+ | `global-no-context-vocab.spec.ts` | Global negative check across 7 routes |
+
+ Seeding goes through new `controlApi` helpers in `helpers/api-client.ts` (`createContext`, `createMcpServer`, user/team context GET/PUT, `createTeam`, `createBudget`, SFS list). Run with `make minikube-pf-all` then `cd tests/e2e/playwright && npx playwright test --project=control-ui <spec>`; env: `CONTROL_UI_URL` (default `:3000`), `CONTROL_API_URL` (default `:8090`), `TEST_ADMIN_USERNAME`/`TEST_ADMIN_PASSWORD` (default `admin`/`changeme123!`). Typecheck gate: `npx tsc -p tsconfig.typecheck.json` (added config — the package tsconfig lacks node types/rootDir for a clean standalone `tsc` run).
- Verification per phase: `cd control-ui && npx tsc --noEmit && npm test` (no lint script exists in control-ui; typecheck via `tsc --noEmit`).
## 10. Progress log (append-only)
@@ -209,6 +231,7 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a
| 2026-08-26 | 4 | Product e2e `control-ui/e2e/registry-install.spec.ts` migrated: install flows drop the removed Context step (one fewer Continue; access scope is provisioned silently); J1 manual-create flows rewritten to the current form (egress via "Advanced options" disclosure on the Connector step, optional Access step passed through, "No credentials required" radio before submit). API-level sections (contextRef payloads, context1 allowlist assertions) intentionally unchanged — the backend contract is untouched. Full vitest 1700/1700 + `tsc` green after migration. |
| 2026-08-27 | audit | Fresh-eyes residual audit (independent pass) + fixes. **Backend re-verified untouched**: `git diff --name-only a584c259a..HEAD` contains zero files outside `control-ui/`, `docs/`, `tests/e2e/` (an apparent `host-context-controller` diff was `origin/dev` moving forward under us mid-run — PR #471, someone else's lane; our branch never touched it). Leaks fixed: (1) RecipeEditor L1 Option B still said "a private Context \"wf-<recipeName>\"" (earlier scripted replace had silently missed it) → "a private connector scope"; (2) `lib/recipeValidator.ts` INFO hint same reword; (3) `lib/contextMutation.ts` default messages neutralized ("A required version is unavailable…", "This access changed since it was loaded…") + `hosts/[name]` regex updated + connectors page now also intercepts the version-unavailable path; (4) token-budget dimension label `context_ref` "Context" → "Connector scope"; (5) "Stored context and provenance" trace-detail heading → "Stored details and provenance"; (6) stale qa-recorder-connector-edit assertion on the removed context-slug meta now asserts it does NOT render. Tests updated (RecipeEditor, GovernedTraceDetails). Remaining "context" words verified as §2.5 exclusions: kubectl `--context` flags in recipe-status hints (kubeconfig syntax), manifest `contextRef` prose (wire format), raw-id fallback labels (by design, muted), `host-context-controller` service label, LLM "User context" (USER.md), guardrail `may add context`, plus intentional legacy redirects in `next.config.js`. Full vitest 1700/1700, `tsc` clean. No backend changes. |
| 2026-08-27 | docs | Source-of-truth restructured after the audit: added §11 (audit report: backend-untouched proof incl. the `origin/dev`-moved warning, leak/fix table, verified intentional remnants), §12 (full click-by-click manual tester walkthrough, tables A–G + global negative check), renumbered open questions to §13; extended the §2.5 exclusion list to the complete audited set; corrected §4 E1 (hover card shows a neutral "Connectors" heading, not the agent name) and the §6.4 heading typo. |
+| 2026-08-27 | e2e | Built the full e2e regression catalog for the §12 flows: 15 new specs + `contexts.spec.ts` extended with the real-slug resolver case (112 tests / 24 files listed for the control-ui project). Extended `helpers/api-client.ts` with context/mcp-server/user-team-contexts/team/budget seeding + teardown helpers (all against the unchanged wire API). Added `tests/e2e/playwright/tsconfig.typecheck.json` so the package typechecks standalone (`npx tsc -p tsconfig.typecheck.json` → clean; the shipped tsconfig lacks node types + a covering rootDir). No specs executed here (no cluster) — they run under the normal `make test-playwright-control-ui` / T2 lane. control-ui unit suite re-verified 1700/1700. No backend changes. |
## 11. Post-implementation audit (2026-08-27)
diff --git a/tests/e2e/playwright/control-ui/agent-connectors-tab.spec.ts b/tests/e2e/playwright/control-ui/agent-connectors-tab.spec.ts
new file mode 100644
index 000000000..b613a13b0
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/agent-connectors-tab.spec.ts
@@ -0,0 +1,110 @@
+/**
+ * Control UI — Agent detail connectors tab
+ *
+ * /agents/<name>/connectors manages the agent's connector set: "Add
+ * connector" opens a picker dialog over the MCP-server catalog, and each
+ * attached connector has a kebab "Remove connector" action behind a confirm
+ * dialog. The agent's private context slug never renders on the page.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+test.describe('Control UI — Agent detail connectors tab', () => {
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('adds and removes a connector through the tab UI without exposing the context slug', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(180_000)
+ const stamp = Date.now()
+ const agentName = `e2e-act-agent-${stamp}`
+ const contextName = `e2e-act-ctx-${stamp}`
+ const serverOne = `e2e-act-srv-a-${stamp}`
+ const serverTwo = `e2e-act-srv-b-${stamp}`
+ try {
+ // PRECONDITION (labeled setup): an empty private context for the agent
+ // (the tab writes connector sets here), two catalog servers the picker
+ // can offer, and the host binding them together.
+ for (const serverName of [serverOne, serverTwo]) {
+ await controlApi.createMcpServer({
+ metadata: { name: serverName },
+ spec: {
+ image: 'clerum/mock-mcp-server:test',
+ contextRef: contextName,
+ enabled: true,
+ managed: true,
+ transport: {
+ type: 'streamableHttp',
+ port: 3000,
+ url: `http://${serverName}.mcp-server.svc.cluster.local:3000/mcp`,
+ },
+ },
+ })
+ }
+ await controlApi.createContext({
+ metadata: { name: contextName },
+ spec: {
+ contextId: contextName,
+ description: `Connectors-tab fixture for ${agentName}`,
+ mcpServers: [],
+ },
+ })
+ await controlApi.createHost({
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef: contextName,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+
+ await authedPage.goto(`/agents/${encodeURIComponent(agentName)}/connectors`)
+ await expect(authedPage.getByText(`Agent: ${agentName}`)).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.getByText('No connectors attached yet.')).toBeVisible({
+ timeout: 15_000,
+ })
+
+ // Add connector — the dialog lists the MCP-server catalog as options;
+ // its confirm button repeats the "Add connector" label.
+ await authedPage.getByRole('button', { name: 'Add connector', exact: true }).click()
+ const dialog = authedPage.getByRole('dialog', { name: 'Add connectors' })
+ await expect(dialog).toBeVisible({ timeout: 10_000 })
+ await expect(dialog.getByRole('option', { name: serverOne, exact: true })).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(dialog.getByRole('option', { name: serverTwo, exact: true })).toBeVisible()
+ await dialog.getByRole('option', { name: serverOne, exact: true }).click()
+ await dialog.getByRole('button', { name: 'Add connector', exact: true }).click()
+
+ await expect(authedPage.getByText('Connectors updated.')).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.getByRole('row', { name: new RegExp(serverOne) })).toBeVisible({
+ timeout: 15_000,
+ })
+
+ // Remove connector — kebab per connector row, then the confirm dialog.
+ await authedPage.getByRole('button', { name: `Actions for connector ${serverOne}` }).click()
+ await authedPage.getByRole('menuitem', { name: 'Remove connector' }).click()
+ const confirmDialog = authedPage.getByRole('alertdialog', {
+ name: 'Remove connector from this agent?',
+ })
+ await expect(confirmDialog).toBeVisible({ timeout: 10_000 })
+ await confirmDialog.getByRole('button', { name: 'Remove connector' }).click()
+
+ await expect(authedPage.getByText('Connectors updated.')).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.getByRole('row', { name: new RegExp(serverOne) })).toHaveCount(0)
+
+ // The private context slug never renders on the page.
+ await expect(authedPage.getByText(contextName)).toHaveCount(0)
+ } finally {
+ await controlApi.ensureHostDeleted(agentName)
+ await controlApi.ensureMcpServerDeleted(serverOne)
+ await controlApi.ensureMcpServerDeleted(serverTwo)
+ await controlApi.ensureContextDeleted(contextName)
+ }
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/agent-create-wizard.spec.ts b/tests/e2e/playwright/control-ui/agent-create-wizard.spec.ts
new file mode 100644
index 000000000..ce4e5286a
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/agent-create-wizard.spec.ts
@@ -0,0 +1,67 @@
+/**
+ * Control UI — Agent create wizard step rail
+ *
+ * The /agents/new wizard must present agents, not contexts: the rail titles
+ * are Agent / Model & Credentials / Access / Add Connectors, and the word
+ * "Context" does not appear anywhere on the page. This spec is read-only —
+ * it never submits the wizard.
+ */
+import type { Page } from '@playwright/test'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+const EXPECTED_RAIL_TITLES = ['Agent', 'Model & Credentials', 'Access', 'Add Connectors']
+
+async function dismissAdminEmailPromptIfPresent(page: Page): Promise<void> {
+ // AdminBridgeAlerts shows "Set up your admin email" for admin accounts
+ // without a recovery email and overlays the page. Dismissing it is a named
+ // test precondition (this suite does not test that prompt); the click is
+ // logged so a run transcript shows exactly what happened.
+ const remindLater = page.getByRole('button', { name: 'Remind me later' })
+ try {
+ await remindLater.waitFor({ state: 'visible', timeout: 3_000 })
+ } catch {
+ return // prompt not shown — nothing to dismiss
+ }
+ console.log('[e2e] dismissing "Set up your admin email" prompt (Remind me later)')
+ await remindLater.click()
+ await remindLater.waitFor({ state: 'hidden', timeout: 5_000 })
+}
+
+test.describe('Control UI — Agent create wizard', () => {
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('step rail lists agent-facing steps and never mentions contexts; Next stays disabled without a name', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto('/agents/new')
+ await expect(
+ authedPage.getByRole('heading', { name: 'Create agent', exact: true })
+ ).toBeVisible({ timeout: 15_000 })
+ await dismissAdminEmailPromptIfPresent(authedPage)
+
+ // Step 0 — the rail shows exactly the four agent-facing step titles, in
+ // order. The old context step must not survive as a rail entry.
+ const railTitles = authedPage.locator('.cu-agent-step-rail__title')
+ await expect(railTitles).toHaveCount(EXPECTED_RAIL_TITLES.length)
+ await expect(railTitles).toHaveText(EXPECTED_RAIL_TITLES)
+
+ // The reachable step body is the name field; with it empty the wizard
+ // cannot advance (Next is the forward action on this wizard).
+ await expect(authedPage.getByPlaceholder('agent-name')).toBeVisible()
+ const nextButton = authedPage.getByRole('button', { name: 'Next', exact: true })
+ await expect(nextButton).toBeVisible()
+ await expect(nextButton).toBeDisabled()
+
+ // The word "Context" must not appear anywhere in the wizard surface
+ // (rail, step panel, header — the sidebar lives outside <main>).
+ const mainText = await authedPage.locator('main').innerText()
+ expect(mainText).not.toMatch(/\bcontext\b/i)
+
+ // Leave without creating anything.
+ await authedPage.getByRole('button', { name: 'Back to agents' }).click()
+ await authedPage.waitForURL('**/agents', { timeout: 15_000 })
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/agent-files-mounted-by.spec.ts b/tests/e2e/playwright/control-ui/agent-files-mounted-by.spec.ts
new file mode 100644
index 000000000..6a482069a
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/agent-files-mounted-by.spec.ts
@@ -0,0 +1,72 @@
+/**
+ * Control UI — Agent Files "Mounted by" column tests
+ *
+ * The Agent Files list and detail pages must speak agent-facing vocabulary:
+ * the mount column is "Mounted by" (never "Mounted by Contexts") and the
+ * detail metadata chip resolves mounts to agent display names, never a raw
+ * context slug (context ids look like "<kebab>-<5 digits>").
+ *
+ * Read-only: it never creates a SharedFileSystem (PVC provisioning is heavy);
+ * detail assertions run only against whatever SFS already exists.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+type SharedFileSystemItem = {
+ metadata?: { name?: string }
+}
+
+test.describe('Control UI — Agent Files — Mounted by', () => {
+ test('list shows the "Mounted by" column header and the agent-facing subtitle', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto('/agent-files')
+
+ await expect(
+ authedPage.getByText('Workspace volumes that agents can mount read-only into their pods.')
+ ).toBeVisible({ timeout: 15_000 })
+
+ // With zero rows the table (and its header) is not rendered at all — the
+ // empty state replaces it. Branch on live data instead of seeding an SFS.
+ const { items } = await controlApi.getSharedFileSystems()
+ const sfsItems = (items ?? []) as SharedFileSystemItem[]
+
+ if (sfsItems.length === 0) {
+ await expect(authedPage.getByText(/No SharedFileSystems yet/)).toBeVisible()
+ await expect(authedPage.locator('th:text-is("Mounted by")')).toHaveCount(0)
+ return
+ }
+
+ await expect(authedPage.locator('th:text-is("Mounted by")')).toBeVisible()
+ // The pre-rename header must be gone everywhere, not just hidden.
+ await expect(authedPage.locator('th:has-text("Mounted by Contexts")')).toHaveCount(0)
+ })
+
+ test('detail metadata chip shows agent-facing mount copy, not a raw context slug', async ({
+ authedPage,
+ }) => {
+ const { items } = await controlApi.getSharedFileSystems()
+ const sfsItems = (items ?? []) as SharedFileSystemItem[]
+ test.skip(sfsItems.length === 0, 'no SharedFileSystem exists to inspect (creation is heavy)')
+
+ const firstName = sfsItems[0]?.metadata?.name ?? ''
+ expect(firstName).not.toBe('')
+
+ await authedPage.goto(`/agent-files/${encodeURIComponent(firstName)}`)
+ const chipRow = authedPage.locator('.cu-chip-row[aria-label="Shared filesystem metadata"]')
+ await expect(chipRow).toBeVisible({ timeout: 15_000 })
+
+ const mountChip = chipRow.locator('.cu-chip', {
+ hasText: /not mounted by any agent|mounted by /u,
+ })
+ await expect(mountChip.first()).toBeVisible()
+
+ const chipText = (await mountChip.first().innerText()).trim()
+ expect(chipText, 'mount chip must use agent-facing copy').toMatch(
+ /not mounted by any agent|mounted by /u
+ )
+ // Raw context slugs look like "<kebab>-<5 digits>" — the chip must never
+ // leak one (unresolved scope ids are hidden by policy instead).
+ expect(chipText, 'mount chip must not leak a raw context slug').not.toMatch(/[-]\d{5}/)
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/agents-connectors-hover.spec.ts b/tests/e2e/playwright/control-ui/agents-connectors-hover.spec.ts
new file mode 100644
index 000000000..bd10f8cd2
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/agents-connectors-hover.spec.ts
@@ -0,0 +1,104 @@
+/**
+ * Control UI — Agents list connectors hover card
+ *
+ * The /agents table summarizes each agent's attached connectors in a count
+ * cell. The agent's private context slug is an implementation detail: the
+ * hover card must show a neutral "Connectors" heading plus the MCP-server
+ * names, never the context. Clicking the count opens the agent's connectors
+ * tab.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+test.describe('Control UI — Agents list connectors hover card', () => {
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('connectors cell hover shows server names without the context slug, click opens the connectors tab', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(120_000)
+ const stamp = Date.now()
+ const agentName = `e2e-ach-agent-${stamp}`
+ const contextName = `e2e-ach-ctx-${stamp}`
+ const serverOne = `e2e-ach-srv-a-${stamp}`
+ const serverTwo = `e2e-ach-srv-b-${stamp}`
+ try {
+ // PRECONDITION (labeled setup): a private context carrying two MCP
+ // servers, plus a host bound to it — the count cell derives from this
+ // context enrichment, not from the Host CR itself.
+ for (const serverName of [serverOne, serverTwo]) {
+ await controlApi.createMcpServer({
+ metadata: { name: serverName },
+ spec: {
+ image: 'clerum/mock-mcp-server:test',
+ contextRef: contextName,
+ enabled: true,
+ managed: true,
+ transport: {
+ type: 'streamableHttp',
+ port: 3000,
+ url: `http://${serverName}.mcp-server.svc.cluster.local:3000/mcp`,
+ },
+ },
+ })
+ }
+ await controlApi.createContext({
+ metadata: { name: contextName },
+ spec: {
+ contextId: contextName,
+ description: `Hover-card fixture for ${agentName}`,
+ mcpServers: [serverOne, serverTwo],
+ },
+ })
+ await controlApi.createHost({
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef: contextName,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+
+ await authedPage.goto('/agents')
+ await expect(
+ authedPage.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible({ timeout: 15_000 })
+
+ const row = authedPage.getByRole('row', { name: new RegExp(agentName) })
+ await expect(row).toBeVisible({ timeout: 20_000 })
+
+ // The count reflects the context enrichment once the contexts fetch
+ // resolves — wait for the concrete value, not just the button.
+ const countButton = row.locator('.cu-host-connectors-count')
+ await expect(countButton).toHaveText('2', { timeout: 20_000 })
+
+ // Hover (focus mirrors hover) reveals the tooltip with the connector
+ // names — and never the private context slug.
+ await countButton.hover()
+ const tooltip = authedPage.getByRole('tooltip')
+ await expect(tooltip).toBeVisible({ timeout: 10_000 })
+ await expect(tooltip).toContainText('Connectors')
+ await expect(tooltip).toContainText(serverOne)
+ await expect(tooltip).toContainText(serverTwo)
+
+ const rowText = await row.innerText()
+ const tooltipText = await tooltip.innerText()
+ expect(rowText).not.toContain(contextName)
+ expect(tooltipText).not.toContain(contextName)
+
+ // Clicking the count opens the agent's connectors tab.
+ await countButton.click()
+ await authedPage.waitForURL(`**/agents/${agentName}/connectors`, { timeout: 15_000 })
+ } finally {
+ await controlApi.ensureHostDeleted(agentName)
+ await controlApi.ensureMcpServerDeleted(serverOne)
+ await controlApi.ensureMcpServerDeleted(serverTwo)
+ await controlApi.ensureContextDeleted(contextName)
+ }
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/connector-create-access-step.spec.ts b/tests/e2e/playwright/control-ui/connector-create-access-step.spec.ts
new file mode 100644
index 000000000..70f20cd6d
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/connector-create-access-step.spec.ts
@@ -0,0 +1,186 @@
+/**
+ * Control UI — Connector create wizard Access step
+ *
+ * /connectors/new walks Connector → Access → Secrets. The Access step offers
+ * an optional agent multi-select: selecting an agent binds the new connector
+ * to that agent's scope; selecting none leaves it unreachable ("No agents
+ * have access yet.") until access is granted from the list.
+ */
+import type { Page } from '@playwright/test'
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+const stamp = Date.now()
+const agentName = `e2e-ccas-agent-${stamp}`
+const contextName = `e2e-ccas-ctx-${stamp}`
+const seedServerName = `e2e-ccas-srv-${stamp}`
+const connectorWithAgent = `e2e-ccas-conn-a-${stamp}`
+const connectorWithoutAgent = `e2e-ccas-conn-b-${stamp}`
+
+async function dismissAdminEmailPromptIfPresent(page: Page): Promise<void> {
+ // AdminBridgeAlerts shows "Set up your admin email" for admin accounts
+ // without a recovery email and overlays the page. Dismissing it is a named
+ // test precondition (this suite does not test that prompt); the click is
+ // logged so a run transcript shows exactly what happened.
+ const remindLater = page.getByRole('button', { name: 'Remind me later' })
+ try {
+ await remindLater.waitFor({ state: 'visible', timeout: 3_000 })
+ } catch {
+ return // prompt not shown — nothing to dismiss
+ }
+ console.log('[e2e] dismissing "Set up your admin email" prompt (Remind me later)')
+ await remindLater.click()
+ await remindLater.waitFor({ state: 'hidden', timeout: 5_000 })
+}
+
+/**
+ * Walks the wizard end-to-end. `agentToSelect` picks the seeded agent on the
+ * Access step; omit it to create the connector with no agent access. The
+ * agent picker's Field label is not programmatically associated with the
+ * dropdown trigger, so the trigger is matched by its placeholder name (the
+ * same contract the component tests rely on).
+ */
+async function createConnectorThroughWizard(
+ page: Page,
+ connectorName: string,
+ agentToSelect?: string
+): Promise<void> {
+ await page.goto('/connectors/new')
+ await expect(page.getByPlaceholder('my-mcp-server')).toBeVisible({ timeout: 15_000 })
+ await dismissAdminEmailPromptIfPresent(page)
+
+ // Step 0 — Connector identity.
+ await page.getByPlaceholder('my-mcp-server').fill(connectorName)
+ await page
+ .getByPlaceholder('us-central1-docker.pkg.dev/my-project/repo/mcp-server:latest')
+ .fill('clerum/mock-mcp-server:test')
+ await page.getByRole('button', { name: 'Continue', exact: true }).click()
+
+ // Step 1 — Access (optional agents).
+ await expect(page.getByRole('heading', { name: 'Agent access' })).toBeVisible({
+ timeout: 10_000,
+ })
+ await expect(
+ page.getByText(
+ 'No agents selected: the connector is created but cannot be used by any agent until you grant access.'
+ )
+ ).toBeVisible()
+ if (agentToSelect) {
+ await page.getByRole('button', { name: 'Select agents...' }).click()
+ await page.getByRole('option', { name: agentToSelect, exact: true }).click()
+ }
+ await page.getByRole('button', { name: 'Continue', exact: true }).click()
+
+ // Step 2 — Secrets and environment.
+ await expect(page.getByRole('heading', { name: 'Secrets and environment' })).toBeVisible({
+ timeout: 10_000,
+ })
+ await page.getByRole('radio', { name: /No credentials required/ }).check()
+ await page.getByRole('button', { name: 'Create connector', exact: true }).click()
+
+ await expect(page.getByText('Connector created successfully.')).toBeVisible({ timeout: 30_000 })
+ await page.waitForURL(/\/connectors\/?$/, { timeout: 15_000 })
+}
+
+async function expandConnector(page: Page, connectorName: string) {
+ const row = page.getByRole('row', { name: new RegExp(connectorName) })
+ await expect(row).toBeVisible({ timeout: 20_000 })
+ await row.click()
+ await expect(row).toHaveAttribute('aria-expanded', 'true', { timeout: 10_000 })
+ const detail = page.locator('.cu-connector-detail')
+ await expect(detail).toBeVisible({ timeout: 10_000 })
+ return detail
+}
+
+/**
+ * A no-agent connector gets a generated private scope (`<name>-<5 digits>`).
+ * The wizard never surfaces it, so teardown finds it by that pattern.
+ */
+async function deletePrivateScopesFor(prefix: string): Promise<void> {
+ try {
+ const { items } = await controlApi.getContexts()
+ const names = items
+ .map(item => String((item as { metadata?: { name?: string } }).metadata?.name ?? ''))
+ .filter(name => new RegExp(`^${prefix}-\\d{5}$`).test(name))
+ for (const name of names) await controlApi.ensureContextDeleted(name)
+ } catch {
+ // best effort — teardown must not mask test failures
+ }
+}
+
+test.describe('Control UI — Connector create Access step', () => {
+ test.describe.configure({ mode: 'serial' })
+
+ test.beforeAll(async () => {
+ // PRECONDITION (labeled setup): a seeded agent bound to a context that
+ // already carries one connector, so the wizard's agent picker and the
+ // connectors list have live entries to work with.
+ await controlApi.createMcpServer({
+ metadata: { name: seedServerName },
+ spec: {
+ image: 'clerum/mock-mcp-server:test',
+ contextRef: contextName,
+ enabled: true,
+ managed: true,
+ transport: {
+ type: 'streamableHttp',
+ port: 3000,
+ url: `http://${seedServerName}.mcp-server.svc.cluster.local:3000/mcp`,
+ },
+ },
+ })
+ await controlApi.createContext({
+ metadata: { name: contextName },
+ spec: {
+ contextId: contextName,
+ description: `Connector create fixture for ${agentName}`,
+ mcpServers: [seedServerName],
+ },
+ })
+ await controlApi.createHost({
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef: contextName,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+ })
+
+ test.afterAll(async () => {
+ await controlApi.ensureMcpServerDeleted(connectorWithAgent)
+ await controlApi.ensureMcpServerDeleted(connectorWithoutAgent)
+ await controlApi.ensureMcpServerDeleted(seedServerName)
+ await controlApi.ensureHostDeleted(agentName)
+ await deletePrivateScopesFor(connectorWithoutAgent)
+ await controlApi.ensureContextDeleted(contextName)
+ })
+
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('a connector created with an agent selected appears bound to that agent', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(180_000)
+ await createConnectorThroughWizard(authedPage, connectorWithAgent, agentName)
+
+ const detail = await expandConnector(authedPage, connectorWithAgent)
+ await expect(detail.getByRole('heading', { name: 'Agents', exact: true })).toBeVisible()
+ await expect(detail.getByText(agentName, { exact: true })).toBeVisible()
+ })
+
+ test('a connector created with no agents selected is not usable by any agent yet', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(180_000)
+ await createConnectorThroughWizard(authedPage, connectorWithoutAgent)
+
+ const detail = await expandConnector(authedPage, connectorWithoutAgent)
+ await expect(detail.getByText('No agents have access yet.')).toBeVisible()
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/connector-edit-access-tab.spec.ts b/tests/e2e/playwright/control-ui/connector-edit-access-tab.spec.ts
new file mode 100644
index 000000000..b7f9b427d
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/connector-edit-access-tab.spec.ts
@@ -0,0 +1,101 @@
+/**
+ * Control UI — Connector edit Access tab
+ *
+ * /connectors/<name>/edit exposes Credentials / External Egress / Access.
+ * The Access tab is a read-only view of the agents, teams, and users that
+ * can reach the connector; the legacy /edit/context deep link redirects to
+ * it.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+test.describe('Control UI — Connector edit Access tab', () => {
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('Access tab shows read-only agent access and the legacy context tab redirects to it', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(120_000)
+ const stamp = Date.now()
+ const serverName = `e2e-ceat-srv-${stamp}`
+ const contextName = `e2e-ceat-ctx-${stamp}`
+ const agentName = `e2e-ceat-agent-${stamp}`
+ try {
+ // PRECONDITION (labeled setup): a connector bound to the agent's
+ // context via spec.mcpServers, so the edit page's Access tab resolves
+ // a non-empty Agents group.
+ await controlApi.createMcpServer({
+ metadata: { name: serverName },
+ spec: {
+ image: 'clerum/mock-mcp-server:test',
+ contextRef: contextName,
+ enabled: true,
+ managed: true,
+ transport: {
+ type: 'streamableHttp',
+ port: 3000,
+ url: `http://${serverName}.mcp-server.svc.cluster.local:3000/mcp`,
+ },
+ },
+ })
+ await controlApi.createContext({
+ metadata: { name: contextName },
+ spec: {
+ contextId: contextName,
+ description: `Connector edit fixture for ${agentName}`,
+ mcpServers: [serverName],
+ },
+ })
+ await controlApi.createHost({
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef: contextName,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+
+ // The edit page exposes exactly the three sections as tabs.
+ await authedPage.goto(`/connectors/${encodeURIComponent(serverName)}/edit`)
+ await expect(
+ authedPage.getByRole('heading', { name: `Edit Connector: ${serverName}`, exact: true })
+ ).toBeVisible({ timeout: 15_000 })
+ const tablist = authedPage.getByRole('tablist', { name: 'Connector edit sections' })
+ await expect(tablist).toBeVisible()
+ await expect(tablist.getByRole('tab', { name: 'Credentials', exact: true })).toBeVisible()
+ await expect(tablist.getByRole('tab', { name: 'External Egress', exact: true })).toBeVisible()
+ await expect(tablist.getByRole('tab', { name: 'Access', exact: true })).toBeVisible()
+
+ // Open the Access tab — read-only groups headed by the bound agent.
+ await tablist.getByRole('tab', { name: 'Access', exact: true }).click()
+ await authedPage.waitForURL(`**/connectors/${serverName}/edit/access`, {
+ timeout: 15_000,
+ })
+ await expect(
+ authedPage.getByRole('heading', { name: 'Agent access', exact: true })
+ ).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.getByRole('heading', { name: 'Agents', exact: true })).toBeVisible()
+ await expect(authedPage.getByText(agentName, { exact: true })).toBeVisible({
+ timeout: 15_000,
+ })
+
+ // Legacy deep link: /edit/context redirects to .../edit/access.
+ await authedPage.goto(`/connectors/${encodeURIComponent(serverName)}/edit/context`)
+ await authedPage.waitForURL(`**/connectors/${serverName}/edit/access`, {
+ timeout: 15_000,
+ })
+ await expect(
+ authedPage.getByRole('heading', { name: 'Agent access', exact: true })
+ ).toBeVisible({ timeout: 15_000 })
+ } finally {
+ await controlApi.ensureMcpServerDeleted(serverName)
+ await controlApi.ensureHostDeleted(agentName)
+ await controlApi.ensureContextDeleted(contextName)
+ }
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/connectors-agent-access.spec.ts b/tests/e2e/playwright/control-ui/connectors-agent-access.spec.ts
new file mode 100644
index 000000000..2274004ae
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/connectors-agent-access.spec.ts
@@ -0,0 +1,156 @@
+/**
+ * Control UI — Connectors list agent access
+ *
+ * /connectors expands each connector row into an Access grid where the
+ * Agents group is operator-managed: per-agent remove (guarded by a shared-
+ * scope confirm when one context backs several agents) and an "Add agents"
+ * picker. Context slugs are the write target, never rendered.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+import { CUI_DASHBOARD } from '../helpers/selectors'
+
+test.describe('Control UI — Connectors agent access', () => {
+ test.beforeEach(async ({ authedPage }) => {
+ await expect(authedPage.locator(CUI_DASHBOARD.HEADING)).toBeVisible()
+ })
+
+ test('manages agent access from the expanded connector row, including the shared-context confirm', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(240_000)
+ const stamp = Date.now()
+ const serverName = `e2e-caa-srv-${stamp}`
+ const contextA = `e2e-caa-ctx-a-${stamp}`
+ const contextB = `e2e-caa-ctx-b-${stamp}`
+ const agentA = `e2e-caa-agent-a-${stamp}`
+ const agentB1 = `e2e-caa-agent-b1-${stamp}`
+ const agentB2 = `e2e-caa-agent-b2-${stamp}`
+ try {
+ // PRECONDITION (labeled setup): one connector carried by two private
+ // contexts — ctxA backs ONE agent, ctxB backs TWO (shared scope), so
+ // removing from ctxB must surface the "Remove Connector Access"
+ // confirm while removing from ctxA must not.
+ await controlApi.createMcpServer({
+ metadata: { name: serverName },
+ spec: {
+ image: 'clerum/mock-mcp-server:test',
+ contextRef: contextA,
+ enabled: true,
+ managed: true,
+ transport: {
+ type: 'streamableHttp',
+ port: 3000,
+ url: `http://${serverName}.mcp-server.svc.cluster.local:3000/mcp`,
+ },
+ },
+ })
+ await controlApi.createContext({
+ metadata: { name: contextA },
+ spec: {
+ contextId: contextA,
+ description: 'Single-agent connector scope',
+ mcpServers: [serverName],
+ },
+ })
+ await controlApi.createContext({
+ metadata: { name: contextB },
+ spec: {
+ contextId: contextB,
+ description: 'Shared two-agent connector scope',
+ mcpServers: [serverName],
+ },
+ })
+ for (const [agentName, contextRef] of [
+ [agentA, contextA],
+ [agentB1, contextB],
+ [agentB2, contextB],
+ ] as const) {
+ await controlApi.createHost({
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+ }
+
+ await authedPage.goto('/connectors')
+ await expect(
+ authedPage.getByText('Browse connector deployments and agent access.', { exact: true })
+ ).toBeVisible({ timeout: 20_000 })
+
+ const expandConnector = async () => {
+ const row = authedPage.getByRole('row', { name: new RegExp(serverName) })
+ await expect(row).toBeVisible({ timeout: 20_000 })
+ await row.click()
+ await expect(row).toHaveAttribute('aria-expanded', 'true', { timeout: 10_000 })
+ const detail = authedPage.locator('.cu-connector-detail')
+ await expect(detail).toBeVisible({ timeout: 10_000 })
+ return detail
+ }
+
+ // Expanded Access section: Agents/Teams/Users groups list all three
+ // agent display names — and no context slug anywhere on the page.
+ let detail = await expandConnector()
+ for (const groupTitle of ['Agents', 'Teams', 'Users']) {
+ await expect(detail.getByRole('heading', { name: groupTitle, exact: true })).toBeVisible()
+ }
+ for (const agentName of [agentA, agentB1, agentB2]) {
+ await expect(detail.getByText(agentName, { exact: true })).toBeVisible()
+ }
+ const bodyText = await authedPage.innerText('body')
+ expect(bodyText).not.toContain(contextA)
+ expect(bodyText).not.toContain(contextB)
+
+ // Remove the single-agent binding — no confirm dialog, direct toast.
+ await detail
+ .getByRole('button', { name: `Remove connector ${serverName} from agent ${agentA}` })
+ .click()
+ await expect(
+ authedPage.getByText(`Connector ${serverName} removed from ${agentA}.`)
+ ).toBeVisible({ timeout: 20_000 })
+
+ // Re-grant agentA through the "Add agents" picker dialog.
+ await authedPage.reload()
+ detail = await expandConnector()
+ await detail.getByRole('button', { name: 'Add agents' }).click()
+ const grantDialog = authedPage.getByRole('dialog', {
+ name: 'Give agents access to this connector',
+ })
+ await expect(grantDialog).toBeVisible({ timeout: 10_000 })
+ await expect(grantDialog.getByLabel('Agents')).toBeVisible()
+ await grantDialog.getByRole('option', { name: agentA, exact: true }).click()
+ await grantDialog.getByRole('button', { name: 'Add to agent', exact: true }).click()
+ await expect(
+ authedPage.getByText(`Connector ${serverName} added to agent ${agentA}.`)
+ ).toBeVisible({ timeout: 20_000 })
+
+ // Remove one agent of the shared pair — the confirm dialog guards the
+ // change that would strip both agents at once.
+ await authedPage.reload()
+ detail = await expandConnector()
+ await detail
+ .getByRole('button', { name: `Remove connector ${serverName} from agent ${agentB1}` })
+ .click()
+ const sharedConfirm = authedPage.getByRole('alertdialog', {
+ name: 'Remove Connector Access',
+ })
+ await expect(sharedConfirm).toBeVisible({ timeout: 10_000 })
+ await sharedConfirm.getByRole('button', { name: 'Remove', exact: true }).click()
+ await expect(
+ authedPage.getByText(`Connector ${serverName} removed from 2 agents.`)
+ ).toBeVisible({ timeout: 20_000 })
+ } finally {
+ await controlApi.ensureMcpServerDeleted(serverName)
+ await controlApi.ensureHostDeleted(agentA)
+ await controlApi.ensureHostDeleted(agentB1)
+ await controlApi.ensureHostDeleted(agentB2)
+ await controlApi.ensureContextDeleted(contextA)
+ await controlApi.ensureContextDeleted(contextB)
+ }
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/contexts.spec.ts b/tests/e2e/playwright/control-ui/contexts.spec.ts
index 988aa73c5..ea0ca8fce 100644
--- a/tests/e2e/playwright/control-ui/contexts.spec.ts
+++ b/tests/e2e/playwright/control-ui/contexts.spec.ts
@@ -4,6 +4,7 @@
* The /contexts section is gone from the UI; legacy deep links resolve
* client-side to user-facing destinations instead of dead-ending.
*/
+import { controlApi } from '../helpers/api-client'
import { expect, test } from '../helpers/auth-fixture'
import { CUI_DASHBOARD } from '../helpers/selectors'
@@ -43,4 +44,41 @@ test.describe('Control UI — Contexts removal', () => {
.first()
).toBeVisible({ timeout: 15_000 })
})
+
+ test('/contexts/<private-slug> resolves to the owning agent Connectors tab', async ({
+ authedPage,
+ }) => {
+ const runId = Date.now()
+ const ctxName = `e2e-pw-resolver-ctx-${runId}`
+ const hostName = `e2e-pw-resolver-host-${runId}`
+ try {
+ await controlApi.ensureContextDeleted(ctxName)
+ await controlApi.createContext({
+ metadata: { name: ctxName },
+ spec: { contextId: ctxName, description: 'contexts.spec.ts redirect fixture' },
+ })
+ await controlApi.ensureHostDeleted(hostName)
+ await controlApi.createHost({
+ metadata: { name: hostName },
+ spec: {
+ host: hostName,
+ contextRef: ctxName,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+
+ await authedPage.goto(`${CONTROL_UI_URL}/contexts/${encodeURIComponent(ctxName)}`)
+ await authedPage.waitForURL(`**/agents/${hostName}/connectors`, { timeout: 15_000 })
+ expect(authedPage.url()).toContain(`/agents/${hostName}/connectors`)
+
+ // Deep link carrying a tab suffix resolves to the same destination.
+ await authedPage.goto(`${CONTROL_UI_URL}/contexts/${encodeURIComponent(ctxName)}/connectors`)
+ await authedPage.waitForURL(`**/agents/${hostName}/connectors`, { timeout: 15_000 })
+ } finally {
+ await controlApi.ensureHostDeleted(hostName)
+ await controlApi.ensureContextDeleted(ctxName)
+ }
+ })
})
diff --git a/tests/e2e/playwright/control-ui/global-no-context-vocab.spec.ts b/tests/e2e/playwright/control-ui/global-no-context-vocab.spec.ts
new file mode 100644
index 000000000..a0ce3db3d
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/global-no-context-vocab.spec.ts
@@ -0,0 +1,79 @@
+/**
+ * Control UI — global "context" vocabulary sweep
+ *
+ * None of the surviving top-level sections may mention contexts in their
+ * chrome or copy after the Contexts-section removal.
+ *
+ * Approach (chosen deliberately, one rule): every swept route renders through
+ * DashboardLayout's <main>, so each page is asserted on its main-content text
+ * (body as fallback). The single exception is /plugins, whose table rows show
+ * user-authored recipe names we do not control — for that page only, the
+ * assertion is scoped to product-owned static chrome (sidebar, panel titles,
+ * subtitles, headings), which cannot be polluted by data-derived names.
+ *
+ * Lines containing "context window" (legitimate LLM copy) are allowed.
+ */
+import type { Page } from '@playwright/test'
+import { expect, test } from '../helpers/auth-fixture'
+
+const CONTEXT_WORD_RE = /\bcontexts?\b/i
+
+const SWEPT_ROUTES = [
+ '/agents',
+ '/connectors',
+ '/users-and-teams/users',
+ '/users-and-teams/teams',
+ '/marketplace/connectors',
+ '/agent-files',
+ '/cost-and-usage/token-budgets',
+] as const
+
+// Product-owned chrome for the /plugins exception (see header comment).
+const STATIC_CHROME_SELECTOR = '.cu-sidebar, .cu-panel-title, .cu-table-panel__subtitle, h1, h2, h3'
+
+function offendingLines(text: string): string[] {
+ return text
+ .split('\n')
+ .filter(line => CONTEXT_WORD_RE.test(line) && !/context window/i.test(line))
+ .map(line => line.trim())
+ .filter(Boolean)
+}
+
+async function mainText(page: Page): Promise<string> {
+ const main = page.locator('main')
+ if ((await main.count()) > 0) return main.first().innerText()
+ return page.locator('body').innerText()
+}
+
+for (const route of SWEPT_ROUTES) {
+ test(`"${route}" shows no context vocabulary`, async ({ authedPage }) => {
+ await authedPage.goto(route)
+ await expect(authedPage.locator('main').first()).toBeVisible({ timeout: 15_000 })
+
+ const text = await mainText(authedPage)
+ const offending = offendingLines(text)
+ expect(
+ offending,
+ `"${route}" must not use context vocabulary; offending lines: ${offending.join(' | ')}`
+ ).toEqual([])
+ })
+}
+
+test('"/plugins" static chrome shows no context vocabulary', async ({ authedPage }) => {
+ await authedPage.goto('/plugins')
+ await expect(authedPage.locator('main').first()).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.locator('.cu-panel-title').first()).toBeVisible({ timeout: 15_000 })
+
+ const chrome = authedPage.locator(STATIC_CHROME_SELECTOR)
+ const count = await chrome.count()
+ const texts: string[] = []
+ for (let i = 0; i < count; i++) {
+ texts.push(await chrome.nth(i).innerText())
+ }
+
+ const offending = offendingLines(texts.join('\n'))
+ expect(
+ offending,
+ `"/plugins" chrome must not use context vocabulary; offending lines: ${offending.join(' | ')}`
+ ).toEqual([])
+})
diff --git a/tests/e2e/playwright/control-ui/marketplace-install-flow.spec.ts b/tests/e2e/playwright/control-ui/marketplace-install-flow.spec.ts
new file mode 100644
index 000000000..91871530d
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/marketplace-install-flow.spec.ts
@@ -0,0 +1,99 @@
+/**
+ * Control UI — Marketplace install flow tests
+ *
+ * The connector install wizard is Package → Credentials → Install with no
+ * context-selection step left anywhere: access is granted after install from
+ * the Installed Connectors list. The install itself is never clicked here —
+ * this spec must not mutate the cluster.
+ */
+import { expect, test } from '../helpers/auth-fixture'
+import { adminSessionCookieHeader } from '../helpers/session-cookie'
+
+const CONTROL_API_URL = process.env.CONTROL_API_URL ?? 'http://127.0.0.1:8090'
+
+type RegistryEntrySummary = {
+ name: string
+ version: string
+ entry_type: string
+ server_mode?: string | null
+}
+
+async function fetchMcpEntries(): Promise<RegistryEntrySummary[]> {
+ const res = await fetch(`${CONTROL_API_URL}/api/v1/admin/registry/entries`, {
+ headers: adminSessionCookieHeader(),
+ })
+ if (!res.ok) {
+ throw new Error(`GET /api/v1/admin/registry/entries → ${res.status}: ${await res.text()}`)
+ }
+ const payload = (await res.json()) as { data?: RegistryEntrySummary[] }
+ return (payload.data ?? []).filter(entry => entry.entry_type === 'mcp-server')
+}
+
+test.describe('Control UI — Marketplace install flow', () => {
+ test('connector install wizard walks Package → Credentials → Install with no context step', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(120_000)
+
+ let entries: RegistryEntrySummary[] = []
+ try {
+ entries = await fetchMcpEntries()
+ } catch {
+ test.skip(true, 'registry API unavailable')
+ }
+ if (entries.length === 0) {
+ test.skip(true, 'no registry entries deployed')
+ }
+ // Prefer a local connector: remote entries require egress before Continue.
+ const entry = entries.find(item => item.server_mode === 'local') ?? entries[0]
+
+ await authedPage.goto(
+ `/marketplace/install?entry=${encodeURIComponent(entry.name)}&version=${encodeURIComponent(entry.version)}`
+ )
+
+ await expect(
+ authedPage.getByRole('heading', { name: 'Install Connector from Marketplace' })
+ ).toBeVisible({ timeout: 30_000 })
+
+ // Step rail is exactly Package / Credentials / Install — no Context step.
+ const rail = authedPage.locator('.cu-agent-step-rail')
+ await expect(rail.locator('.cu-agent-step-rail__title')).toHaveText([
+ 'Package',
+ 'Credentials',
+ 'Install',
+ ])
+ await expect(rail.getByText(/context/i)).toHaveCount(0)
+ await expect(authedPage.getByRole('button').filter({ hasText: /context/i })).toHaveCount(0)
+ await expect(authedPage.locator('body')).not.toContainText(/Select a context|Context access/)
+
+ // Package → Credentials
+ const continueButton = authedPage.getByRole('button', { name: 'Continue', exact: true })
+ await expect(continueButton).toBeEnabled({ timeout: 30_000 })
+ await continueButton.click()
+ await expect(rail.locator('.cu-agent-step-rail__item').nth(1)).toHaveAttribute(
+ 'data-state',
+ 'current'
+ )
+ await expect(authedPage.locator('body')).not.toContainText(/Select a context|Context access/)
+
+ // Credentials → Install
+ await expect(continueButton).toBeEnabled({ timeout: 30_000 })
+ await continueButton.click()
+ await expect(rail.locator('.cu-agent-step-rail__item').nth(2)).toHaveAttribute(
+ 'data-state',
+ 'current'
+ )
+
+ // Install summary names the connector; the button is armed but never clicked.
+ const summary = authedPage.getByRole('region', { name: 'Install summary' })
+ await expect(summary).toBeVisible({ timeout: 15_000 })
+ await expect(summary).toContainText(entry.name)
+ const installButton = authedPage.getByRole('button', { name: 'Install', exact: true })
+ await expect(installButton).toBeEnabled({ timeout: 30_000 })
+ await expect(authedPage.locator('body')).not.toContainText(/Select a context|Context access/)
+
+ // Navigate away without installing.
+ await authedPage.goto('/marketplace')
+ await authedPage.waitForURL('**/marketplace/connectors', { timeout: 15_000 })
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/member-access-tab.spec.ts b/tests/e2e/playwright/control-ui/member-access-tab.spec.ts
new file mode 100644
index 000000000..7b67f5a98
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/member-access-tab.spec.ts
@@ -0,0 +1,116 @@
+/**
+ * Control UI — Member detail Access tab tests
+ *
+ * The member "Access" tab (the former "Contexts" tab) must present host-backed
+ * access scopes by their agent display name (spec.host), never by the raw wire
+ * contextId, and the add/remove flows must round-trip the admin context API.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+const RUN = Date.now()
+const CONTEXT_NAME = `e2e-member-access-ctx-${RUN}`
+const CONTEXT_ID = `e2e-member-access-scope-${RUN}`
+const HOST_NAME = `e2e-member-access-host-${RUN}`
+const HOST_DISPLAY_NAME = `e2e-member-access-agent-${RUN}`
+
+let userId = ''
+let originalContextIds: string[] = []
+
+test.describe('Control UI — Member Access tab', () => {
+ test.describe.configure({ mode: 'serial' })
+
+ test.beforeAll(async () => {
+ const { items } = await controlApi.getUsers('')
+ if (items.length === 0) {
+ test.skip(true, 'no users seeded — run: make minikube-seed-test-data')
+ return
+ }
+ userId = items[0].id
+ originalContextIds = (await controlApi.getUserContexts(userId)).contextIds ?? []
+
+ await controlApi.createContext({
+ metadata: { name: CONTEXT_NAME },
+ spec: { contextId: CONTEXT_ID, description: 'E2E member access scope' },
+ })
+ await controlApi.createHost({
+ metadata: { name: HOST_NAME },
+ spec: {
+ host: HOST_DISPLAY_NAME,
+ contextRef: CONTEXT_ID,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+ await controlApi.updateUserContexts(userId, [...originalContextIds, CONTEXT_ID])
+ })
+
+ test.afterAll(async () => {
+ if (userId) {
+ try {
+ await controlApi.updateUserContexts(userId, originalContextIds)
+ } catch {
+ // best effort restore — cluster may already be unreachable
+ }
+ }
+ await controlApi.ensureHostDeleted(HOST_NAME)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ })
+
+ test('shows the agent display name, not the raw scope id', async ({ authedPage }) => {
+ await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
+ await expect(
+ authedPage.getByText('Agents and connector scopes this member may access.')
+ ).toBeVisible({ timeout: 15_000 })
+
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
+ await expect(row).toHaveCount(1)
+ await expect(row).not.toContainText(CONTEXT_ID)
+ })
+
+ test("'Add access' opens the access picker modal", async ({ authedPage }) => {
+ await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
+ await expect(
+ authedPage.getByText('Agents and connector scopes this member may access.')
+ ).toBeVisible({ timeout: 15_000 })
+
+ await authedPage.getByRole('button', { name: 'Add access', exact: true }).click()
+
+ const dialog = authedPage.getByRole('dialog', { name: 'Add access' })
+ await expect(dialog).toBeVisible()
+ await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.getByRole('button', { name: 'Add access', exact: true })).toBeVisible()
+ await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
+ await expect(dialog).toHaveCount(0)
+ })
+
+ test('removing access confirms, toasts, and clears the mapping via the API', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
+ await expect(row).toBeVisible({ timeout: 15_000 })
+
+ await row.getByLabel('Remove access').click()
+
+ const confirmDialog = authedPage.getByRole('alertdialog', { name: 'Remove Access' })
+ await expect(confirmDialog).toBeVisible()
+ await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
+
+ await expect(authedPage.getByRole('status').filter({ hasText: 'Access updated.' })).toBeVisible(
+ { timeout: 15_000 }
+ )
+ await expect(row).toHaveCount(0)
+ if (originalContextIds.length === 0) {
+ await expect(authedPage.getByText('No access assigned yet.')).toBeVisible()
+ }
+
+ const { contextIds } = await controlApi.getUserContexts(userId)
+ expect(contextIds ?? []).not.toContain(CONTEXT_ID)
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/recipe-scope-copy.spec.ts b/tests/e2e/playwright/control-ui/recipe-scope-copy.spec.ts
new file mode 100644
index 000000000..4048b4b93
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/recipe-scope-copy.spec.ts
@@ -0,0 +1,180 @@
+/**
+ * Control UI — Recipe editor connector-scope copy tests
+ *
+ * The recipe editor's context-removal vocabulary:
+ * - L1 policy banner (step "confirm") for agentic recipes that set
+ * spec.contextRef without security.allowContextRef: must say "shared
+ * connector scope" and "WRC will auto-create a private connector scope",
+ * and must NOT say "private Context".
+ * - INFO note for recipes with a transport workload and no spec.contextRef:
+ * "Omitted — WRC will auto-create a private connector scope for this recipe."
+ *
+ * Recipes are created through the admin API and opened on their edit page
+ * (/plugins/<ns>/<name>?edit=1 — rewritten by next.config.js to
+ * /workflow-recipes/<ns>/<name>?edit=1, which mounts the RecipeEditor).
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+const RUN_ID = Date.now()
+const CONTEXT_NAME = `e2e-pw-recipe-ctx-${RUN_ID}`
+const AGENTIC_RECIPE_NAME = `e2e-pw-recipe-agentic-${RUN_ID}`
+const TRANSPORT_RECIPE_NAME = `e2e-pw-recipe-transport-${RUN_ID}`
+const RECIPE_NAMESPACE_FALLBACK = 'sandbox-recipes'
+
+// A minimal agentic manifest (spec.steps[]) based on the working fixtures in
+// recipes.spec.ts: the MODAL_RECIPE workload plus the SNIPPET step shape.
+// WITHOUT security.allowContextRef this is exactly the state L1 must reject.
+function agenticManifestWithoutOptIn(): string {
+ return JSON.stringify(
+ {
+ apiVersion: 'clerum.io/v1alpha1',
+ kind: 'WorkflowRecipe',
+ metadata: { name: AGENTIC_RECIPE_NAME },
+ spec: {
+ contextRef: CONTEXT_NAME,
+ workloads: [{ id: 'web', type: 'deployment', image: 'nginx:1.30.1-alpine' }],
+ steps: [
+ {
+ id: 'run',
+ run: { type: 'snippet', language: 'typescript', code: 'return { ok: true }' },
+ },
+ ],
+ },
+ },
+ null,
+ 2
+ )
+}
+
+// Transport (MCP) workload, no spec.contextRef — the shape that must produce
+// the INFO note about WRC's auto-created private connector scope.
+function transportManifest(): string {
+ return JSON.stringify(
+ {
+ apiVersion: 'clerum.io/v1alpha1',
+ kind: 'WorkflowRecipe',
+ metadata: { name: TRANSPORT_RECIPE_NAME },
+ spec: {
+ workloads: [
+ {
+ id: 'mock-tools',
+ type: 'deployment',
+ image: 'clerum/mock-mcp-server:test',
+ port: 3000,
+ transport: { type: 'streamableHttp', path: '/mcp' },
+ },
+ ],
+ },
+ },
+ null,
+ 2
+ )
+}
+
+type CreatedRecipe = { metadata?: { namespace?: string } }
+
+async function createRecipeViaApi(manifest: string): Promise<string> {
+ const created = (await controlApi.createRecipe(JSON.parse(manifest))) as CreatedRecipe
+ return created?.metadata?.namespace ?? RECIPE_NAMESPACE_FALLBACK
+}
+
+test.describe('Control UI — Recipe editor — connector scope copy', () => {
+ test.beforeAll(async () => {
+ // Orphan cleanup from a previous crashed run, then seed the shared context.
+ await controlApi.ensureRecipeDeleted(AGENTIC_RECIPE_NAME)
+ await controlApi.ensureRecipeDeleted(TRANSPORT_RECIPE_NAME)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ await controlApi.createContext({
+ metadata: { name: CONTEXT_NAME },
+ spec: { contextId: CONTEXT_NAME, description: 'recipe-scope-copy e2e fixture' },
+ })
+ })
+
+ test.afterAll(async () => {
+ await controlApi.ensureRecipeDeleted(AGENTIC_RECIPE_NAME)
+ await controlApi.ensureRecipeDeleted(TRANSPORT_RECIPE_NAME)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ })
+
+ test('agentic recipe with spec.contextRef and no opt-in shows the connector-scope policy banner', async ({
+ authedPage,
+ }) => {
+ // The API's policy gate (checkPolicyInvariant) only stores agentic recipes
+ // that carry security.allowContextRef=true together with a namespace
+ // WorkflowRecipePolicy (the minikube overlay ships that dev policy), so the
+ // seeded recipe includes the opt-in flag. The editor JSON below strips it,
+ // reproducing the exact state the L1 banner must reject.
+ const namespace = await createRecipeViaApi(
+ JSON.stringify({
+ apiVersion: 'clerum.io/v1alpha1',
+ kind: 'WorkflowRecipe',
+ metadata: { name: AGENTIC_RECIPE_NAME },
+ spec: {
+ contextRef: CONTEXT_NAME,
+ security: { allowContextRef: true },
+ workloads: [{ id: 'web', type: 'deployment', image: 'nginx:1.30.1-alpine' }],
+ steps: [
+ {
+ id: 'run',
+ run: { type: 'snippet', language: 'typescript', code: 'return { ok: true }' },
+ },
+ ],
+ },
+ })
+ )
+
+ await authedPage.goto(
+ `/plugins/${encodeURIComponent(namespace)}/${encodeURIComponent(AGENTIC_RECIPE_NAME)}?edit=1`
+ )
+ const textarea = authedPage.locator('textarea')
+ await expect(textarea).toBeVisible({ timeout: 20_000 })
+
+ // Drop the opt-in flag — the manifest now sets spec.contextRef on an
+ // agentic recipe without security.allowContextRef.
+ await textarea.fill(agenticManifestWithoutOptIn())
+
+ const primaryAction = authedPage.locator('.cu-create-actions button')
+ await primaryAction.filter({ hasText: 'Review manifest' }).click()
+ await expect(authedPage.getByText(/Manifest review passed/)).toBeVisible()
+
+ await primaryAction.filter({ hasText: 'Apply defaults' }).click()
+ await primaryAction.filter({ hasText: 'Continue to access' }).click()
+
+ const banner = authedPage.locator('.cu-recipe-status-panel--error[role="alert"]')
+ await expect(banner).toBeVisible()
+ await expect(banner).toContainText('Cannot deploy: policy violation')
+ await expect(banner).toContainText('shared connector scope')
+ await expect(banner).toContainText('WRC will auto-create a private connector scope')
+ await expect(banner).not.toContainText('private Context')
+ })
+
+ test('transport recipe without spec.contextRef shows the omitted-scope informational note', async ({
+ authedPage,
+ }) => {
+ const namespace = await createRecipeViaApi(transportManifest())
+
+ await authedPage.goto(
+ `/plugins/${encodeURIComponent(namespace)}/${encodeURIComponent(TRANSPORT_RECIPE_NAME)}?edit=1`
+ )
+ const textarea = authedPage.locator('textarea')
+ await expect(textarea).toBeVisible({ timeout: 20_000 })
+ await textarea.fill(transportManifest())
+
+ await authedPage
+ .locator('.cu-create-actions button')
+ .filter({ hasText: 'Review manifest' })
+ .click()
+
+ await expect(authedPage.getByText(/Manifest review passed/)).toBeVisible()
+ const infoGroup = authedPage.locator('.cu-recipe-issue-group--info')
+ await expect(infoGroup).toBeVisible()
+ await expect(infoGroup).toContainText('Informational notes')
+ await expect(
+ authedPage.getByText(
+ /Omitted — WRC will auto-create a private connector scope for this recipe\./u
+ )
+ ).toBeVisible()
+ await expect(infoGroup).not.toContainText('private Context')
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/team-access-tab.spec.ts b/tests/e2e/playwright/control-ui/team-access-tab.spec.ts
new file mode 100644
index 000000000..50ba0363c
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/team-access-tab.spec.ts
@@ -0,0 +1,113 @@
+/**
+ * Control UI — Team detail Access tab tests
+ *
+ * The team "Access" tab (the former "Contexts" tab) must present host-backed
+ * access scopes by their agent display name, the add/remove flows must
+ * round-trip the admin team-context API, and the legacy /contexts deep link
+ * must redirect to /access.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+const RUN = Date.now()
+const TEAM_NAME = `e2e-team-access-team-${RUN}`
+const CONTEXT_NAME = `e2e-team-access-ctx-${RUN}`
+const CONTEXT_ID = `e2e-team-access-scope-${RUN}`
+const HOST_NAME = `e2e-team-access-host-${RUN}`
+const HOST_DISPLAY_NAME = `e2e-team-access-agent-${RUN}`
+
+let teamId = ''
+
+test.describe('Control UI — Team Access tab', () => {
+ test.describe.configure({ mode: 'serial' })
+
+ test.beforeAll(async () => {
+ const team = await controlApi.createTeam(TEAM_NAME)
+ teamId = team.id
+
+ await controlApi.createContext({
+ metadata: { name: CONTEXT_NAME },
+ spec: { contextId: CONTEXT_ID, description: 'E2E team access scope' },
+ })
+ await controlApi.createHost({
+ metadata: { name: HOST_NAME },
+ spec: {
+ host: HOST_DISPLAY_NAME,
+ contextRef: CONTEXT_ID,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+ await controlApi.updateTeamContexts(teamId, [CONTEXT_ID])
+ })
+
+ test.afterAll(async () => {
+ if (teamId) await controlApi.ensureTeamDeleted(teamId)
+ await controlApi.ensureHostDeleted(HOST_NAME)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ })
+
+ test('shows the agent display name, not the raw scope id', async ({ authedPage }) => {
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
+ await expect(authedPage.getByText('Members, connector access, and agents.')).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(
+ authedPage.getByText('Agents and connector scopes this team may access.')
+ ).toBeVisible()
+
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
+ await expect(row).toHaveCount(1)
+ await expect(row).not.toContainText(CONTEXT_ID)
+ })
+
+ test("'Add access' opens the access picker modal", async ({ authedPage }) => {
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
+ await expect(
+ authedPage.getByText('Agents and connector scopes this team may access.')
+ ).toBeVisible({ timeout: 15_000 })
+
+ await authedPage.getByRole('button', { name: 'Add access', exact: true }).click()
+
+ const dialog = authedPage.getByRole('dialog', { name: 'Add access' })
+ await expect(dialog).toBeVisible()
+ await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.getByRole('button', { name: 'Add access', exact: true })).toBeVisible()
+ await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
+ await expect(dialog).toHaveCount(0)
+ })
+
+ test('removing access confirms, toasts, and clears the mapping via the API', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
+ await expect(row).toBeVisible({ timeout: 15_000 })
+
+ await row.getByLabel('Remove access').click()
+
+ const confirmDialog = authedPage.getByRole('alertdialog', { name: 'Remove Access' })
+ await expect(confirmDialog).toBeVisible()
+ await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
+
+ await expect(
+ authedPage.getByRole('status').filter({ hasText: 'Team access updated.' })
+ ).toBeVisible({ timeout: 15_000 })
+ await expect(row).toHaveCount(0)
+ await expect(authedPage.getByText('No access assigned yet.')).toBeVisible()
+
+ const { contextIds } = await controlApi.getTeamContexts(teamId)
+ expect(contextIds ?? []).not.toContain(CONTEXT_ID)
+ })
+
+ test('legacy /contexts deep link redirects to /access', async ({ authedPage }) => {
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/contexts`)
+ await authedPage.waitForURL('**/users-and-teams/teams/*/access', { timeout: 15_000 })
+ expect(authedPage.url()).toContain(`/teams/${teamId}/access`)
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts b/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts
new file mode 100644
index 000000000..ce834831c
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts
@@ -0,0 +1,114 @@
+/**
+ * Control UI — Team create wizard Access step tests
+ *
+ * The wizard rail is Team → Members → Access → Agents; the Access step offers
+ * agent display names (not raw scope ids) and a selection made there lands on
+ * the created team as a real context mapping.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+const RUN = Date.now()
+const TEAM_NAME = `e2e-wizard-team-${RUN}`
+const CONTEXT_NAME = `e2e-wizard-ctx-${RUN}`
+const CONTEXT_ID = `e2e-wizard-scope-${RUN}`
+const HOST_NAME = `e2e-wizard-host-${RUN}`
+const HOST_DISPLAY_NAME = `e2e-wizard-agent-${RUN}`
+
+async function waitForTeamIdByName(name: string): Promise<string> {
+ const deadline = Date.now() + 30_000
+ for (;;) {
+ const { items } = await controlApi.getTeams()
+ const match = items.find(team => team.name === name)
+ if (match) return match.id
+ if (Date.now() > deadline) return ''
+ await new Promise(resolve => setTimeout(resolve, 1_000))
+ }
+}
+
+test.describe('Control UI — Team create wizard', () => {
+ test.describe.configure({ mode: 'serial' })
+
+ test.beforeAll(async () => {
+ await controlApi.createContext({
+ metadata: { name: CONTEXT_NAME },
+ spec: { contextId: CONTEXT_ID, description: 'E2E team wizard access scope' },
+ })
+ await controlApi.createHost({
+ metadata: { name: HOST_NAME },
+ spec: {
+ host: HOST_DISPLAY_NAME,
+ contextRef: CONTEXT_ID,
+ secretRef: '',
+ channels: [],
+ model: { provider: 'openai', name: 'gpt-5.4-mini' },
+ },
+ })
+ })
+
+ test.afterAll(async () => {
+ if (TEAM_NAME) {
+ try {
+ const teamId = await waitForTeamIdByName(TEAM_NAME)
+ if (teamId) await controlApi.ensureTeamDeleted(teamId)
+ } catch {
+ // best effort — team creation may have failed or cluster is unreachable
+ }
+ }
+ await controlApi.ensureHostDeleted(HOST_NAME)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ })
+
+ test('Access step grants by agent display name and lands the mapping on the team', async ({
+ authedPage,
+ }) => {
+ test.setTimeout(120_000)
+ await authedPage.goto('/users-and-teams/teams/new')
+
+ await expect(authedPage.locator('.cu-agent-step-rail__title')).toHaveText([
+ 'Team',
+ 'Members',
+ 'Access',
+ 'Agents',
+ ])
+
+ // Step 1 — Team identity
+ await authedPage.getByLabel('Team name').fill(TEAM_NAME)
+ await authedPage.getByRole('button', { name: 'Continue', exact: true }).click()
+
+ // Step 2 — Members: skip for now
+ await authedPage.getByRole('button', { name: 'Skip', exact: true }).click()
+ await expect(
+ authedPage.getByText('Choose the agents and connector scopes this team can use.')
+ ).toBeVisible({ timeout: 15_000 })
+
+ // Step 3 — Access: options resolve to agent display names, never raw ids
+ await authedPage.locator('#new-team-access-picker').click()
+ const seededOption = authedPage.getByRole('option', {
+ name: HOST_DISPLAY_NAME,
+ exact: true,
+ })
+ await expect(seededOption).toBeVisible({ timeout: 15_000 })
+ await expect(authedPage.getByRole('option', { name: CONTEXT_ID, exact: true })).toHaveCount(0)
+ await seededOption.click()
+ await expect(authedPage.locator('#new-team-access-picker')).toContainText(HOST_DISPLAY_NAME)
+ await authedPage.keyboard.press('Escape')
+ await authedPage.getByRole('button', { name: 'Continue', exact: true }).click()
+
+ // Step 4 — Agents: none for this flow, then create
+ await authedPage.getByRole('button', { name: 'Create team', exact: true }).click()
+ await authedPage.waitForURL('**/users-and-teams/teams', { timeout: 30_000 })
+
+ const teamId = await waitForTeamIdByName(TEAM_NAME)
+ expect(teamId).not.toBe('')
+ const { contextIds } = await controlApi.getTeamContexts(teamId)
+ expect(contextIds ?? []).toContain(CONTEXT_ID)
+
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
+ await expect(row).toBeVisible({ timeout: 15_000 })
+ await expect(row).not.toContainText(CONTEXT_ID)
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/token-budget-scope-label.spec.ts b/tests/e2e/playwright/control-ui/token-budget-scope-label.spec.ts
new file mode 100644
index 000000000..8bfbec2fe
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/token-budget-scope-label.spec.ts
@@ -0,0 +1,58 @@
+/**
+ * Control UI — Token budget scope label tests
+ *
+ * A budget scoped on context_ref must render the scope chip as
+ * "Connector scope: <id>" (formatBudgetScope joins the dimension label and
+ * value). The legacy "Context" wording must not appear in the scope cell.
+ */
+import { controlApi } from '../helpers/api-client'
+import { expect, test } from '../helpers/auth-fixture'
+
+const RUN_ID = Date.now()
+const CONTEXT_NAME = `e2e-pw-budget-ctx-${RUN_ID}`
+const BUDGET_NAME = `e2e-pw-budget-${RUN_ID}`
+
+test.describe('Control UI — Token budgets — scope label', () => {
+ let budgetId = ''
+
+ test.beforeAll(async () => {
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ await controlApi.createContext({
+ metadata: { name: CONTEXT_NAME },
+ spec: { contextId: CONTEXT_NAME, description: 'token-budget scope label fixture' },
+ })
+ })
+
+ test.afterAll(async () => {
+ if (budgetId) await controlApi.ensureBudgetDeleted(budgetId)
+ await controlApi.ensureContextDeleted(CONTEXT_NAME)
+ })
+
+ test('context_ref budget scope renders as "Connector scope"', async ({ authedPage }) => {
+ const budget = await controlApi.createBudget({
+ name: BUDGET_NAME,
+ enabled: true,
+ scope: { context_ref: [CONTEXT_NAME] },
+ unit: 'tokens',
+ limit_amount: 1000000,
+ period: 'monthly',
+ timezone: 'UTC',
+ enforcement: 'warn',
+ })
+ budgetId = budget.id
+
+ await authedPage.goto('/cost-and-usage/token-budgets')
+ const row = authedPage.locator('tr', { hasText: BUDGET_NAME }).first()
+ await expect(row).toBeVisible({ timeout: 15_000 })
+
+ // Column order: Name, Scope, Unit, … (TokenBudgetTable BUDGET_COLUMNS).
+ const scopeCell = row.locator('td').nth(1)
+ await expect(scopeCell.getByText('Connector scope', { exact: true })).toBeVisible()
+ await expect(scopeCell.getByText(CONTEXT_NAME, { exact: true })).toBeVisible()
+
+ const scopeText = await scopeCell.innerText()
+ expect(scopeText, 'scope cell must not use the legacy "Context" wording').not.toMatch(
+ /\bContext\b/
+ )
+ })
+})
diff --git a/tests/e2e/playwright/control-ui/users-teams-access-column.spec.ts b/tests/e2e/playwright/control-ui/users-teams-access-column.spec.ts
new file mode 100644
index 000000000..68c235629
--- /dev/null
+++ b/tests/e2e/playwright/control-ui/users-teams-access-column.spec.ts
@@ -0,0 +1,46 @@
+/**
+ * Control UI — Users and Teams Access column tests
+ *
+ * The Teams table exposes a sortable "Access" column (the former "Contexts"
+ * count column) and neither the Teams nor the Users table keeps a "Contexts"
+ * header anywhere.
+ */
+import { expect, test } from '../helpers/auth-fixture'
+
+test.describe('Control UI — Users and Teams Access column', () => {
+ test('Teams table has a sortable Access column and no Contexts header', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto('/users-and-teams/teams')
+
+ const accessHeader = authedPage.getByRole('button', { name: /^Sort by access/ })
+ await expect(accessHeader).toBeVisible({ timeout: 15_000 })
+ // Let the skeleton table swap for real data before counting rows.
+ await expect(authedPage.locator('.cu-skeleton')).toHaveCount(0, { timeout: 15_000 })
+ await expect(authedPage.locator('th', { hasText: 'Contexts' })).toHaveCount(0)
+
+ const rows = authedPage.getByRole('row')
+ const rowCountBefore = await rows.count()
+
+ // First click: inactive → descending (aria-label announces the next direction)
+ await accessHeader.click()
+ await expect(accessHeader).toHaveAttribute('aria-label', 'Sort by access ascending')
+ const rowCountAfterFirst = await rows.count()
+ expect(rowCountAfterFirst).toBe(rowCountBefore)
+
+ // Second click: descending → ascending
+ await accessHeader.click()
+ await expect(accessHeader).toHaveAttribute('aria-label', 'Sort by access descending')
+ const rowCountAfterSecond = await rows.count()
+ expect(rowCountAfterSecond).toBe(rowCountBefore)
+ })
+
+ test('Users table has no Contexts header', async ({ authedPage }) => {
+ await authedPage.goto('/users-and-teams/users')
+
+ await expect(authedPage.locator('th', { hasText: 'Name' }).first()).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(authedPage.locator('th', { hasText: 'Contexts' })).toHaveCount(0)
+ })
+})
diff --git a/tests/e2e/playwright/helpers/api-client.ts b/tests/e2e/playwright/helpers/api-client.ts
index cf6d3c95f..16a441638 100644
--- a/tests/e2e/playwright/helpers/api-client.ts
+++ b/tests/e2e/playwright/helpers/api-client.ts
@@ -188,4 +188,90 @@ export const controlApi = {
// ignore — channel may not exist (404) or cluster may be unreachable
}
},
+
+ // ── Context-removal e2e seeding (wire contract only — no UI concepts) ────
+
+ async createContext(payload: {
+ metadata: { name: string }
+ spec: { contextId: string; description?: string; mcpServers?: string[] }
+ }): Promise<unknown> {
+ return apiFetch<unknown>('POST', '/api/v1/admin/contexts', payload)
+ },
+
+ async updateContext(
+ name: string,
+ payload: { metadata: { resourceVersion: string }; spec: Record<string, unknown> }
+ ): Promise<unknown> {
+ return apiFetch<unknown>('PUT', `/api/v1/admin/contexts/${encodeURIComponent(name)}`, payload)
+ },
+
+ async getMcpServers(): Promise<{ items: unknown[] }> {
+ return apiFetch<{ items: unknown[] }>('GET', '/api/v1/admin/mcp-servers')
+ },
+
+ async createMcpServer(payload: unknown): Promise<unknown> {
+ return apiFetch<unknown>('POST', '/api/v1/admin/mcp-servers', payload)
+ },
+
+ async ensureMcpServerDeleted(name: string): Promise<void> {
+ try {
+ await apiFetch<unknown>('DELETE', `/api/v1/admin/mcp-servers/${encodeURIComponent(name)}`)
+ } catch {
+ // ignore — server may not exist (404) or cluster may be unreachable
+ }
+ },
+
+ async getUserContexts(userId: string): Promise<{ contextIds: string[] }> {
+ return apiFetch<{ contextIds: string[] }>(
+ 'GET',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/contexts`
+ )
+ },
+
+ async updateUserContexts(userId: string, contextIds: string[]): Promise<unknown> {
+ return apiFetch<unknown>('PUT', `/api/v1/admin/users/${encodeURIComponent(userId)}/contexts`, {
+ contextIds,
+ })
+ },
+
+ async getTeamContexts(teamId: string): Promise<{ contextIds: string[] }> {
+ return apiFetch<{ contextIds: string[] }>(
+ 'GET',
+ `/api/v1/admin/teams/${encodeURIComponent(teamId)}/contexts`
+ )
+ },
+
+ async updateTeamContexts(teamId: string, contextIds: string[]): Promise<unknown> {
+ return apiFetch<unknown>('PUT', `/api/v1/admin/teams/${encodeURIComponent(teamId)}/contexts`, {
+ contextIds,
+ })
+ },
+
+ async createTeam(name: string): Promise<{ id: string; name: string }> {
+ return apiFetch<{ id: string; name: string }>('POST', '/api/v1/admin/teams', { name })
+ },
+
+ async ensureTeamDeleted(teamId: string): Promise<void> {
+ try {
+ await apiFetch<unknown>('DELETE', `/api/v1/admin/teams/${encodeURIComponent(teamId)}`)
+ } catch {
+ // ignore — team may not exist (404) or cluster may be unreachable
+ }
+ },
+
+ async createBudget(input: Record<string, unknown>): Promise<{ id: string }> {
+ return apiFetch<{ id: string }>('POST', '/api/v1/admin/budgets', input)
+ },
+
+ async ensureBudgetDeleted(id: string): Promise<void> {
+ try {
+ await apiFetch<unknown>('DELETE', `/api/v1/admin/budgets/${encodeURIComponent(id)}`)
+ } catch {
+ // ignore — budget may not exist (404) or cluster may be unreachable
+ }
+ },
+
+ async getSharedFileSystems(): Promise<{ items: unknown[] }> {
+ return apiFetch<{ items: unknown[] }>('GET', '/api/v1/admin/shared-filesystems')
+ },
}
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": {
diff --git a/tests/e2e/playwright/tsconfig.typecheck.json b/tests/e2e/playwright/tsconfig.typecheck.json
new file mode 100644
index 000000000..6d6b5418f
--- /dev/null
+++ b/tests/e2e/playwright/tsconfig.typecheck.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "noEmit": true,
+ "types": ["node"],
+ "rootDir": ".."
+ },
+ "include": ["**/*.ts", "../testUser.ts"]
+}