Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-ui): human-paced e2e of the connector credential-rotation journey
Alfredo Lopeze92a1402b20f
diff --git a/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.ts b/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.tsnew file mode 100644index 000000000..6dfbf5d33--- /dev/null+++ b/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.ts@@ -0,0 +1,149 @@+// Human demo of the issue #223 credential-rotation journey, driven ENTIRELY+// through the UI so a recording reads like a cluster operator doing it by hand:+// sign in -> sidebar "Connectors" -> expand the connector row -> "Edit" ->+// scroll to "Update credentials" -> type the new value -> "Rotate credentials"+// -> confirm "Rotate & restart" -> watch the rollout reach "Credentials rotated".+//+// Preconditions (Secret + context + a MANAGED connector on the mock MCP image)+// are staged via the Control API so the rotation reaches a genuine+// DeploymentReady=True (not the tolerated timeout). Recorded via the+// human-e2e-recorder skill (headed, slowMo, video). Opt-in: QA_RECORDER_CONFIRM_MUTATIONS=1.+import { expect, test } from '@playwright/test'+import {+ CONTROL_API_URL,+ CONTROL_UI_URL,+ adminCredentials,+ api,+ assertAllowedTarget,+ loginThroughUi,+ requireRecorderConfirm,+ uniqueE2EName,+} from './qa-recorder-helpers'+import { humanClick, humanPause, humanReveal, humanType } from './support/human'++const MOCK_MCP_IMAGE = process.env.TEST_MOCK_MCP_IMAGE ?? 'clerum/mock-mcp-server:test'++test.describe('demo: Control UI credential-rotation journey', () => {+ test('a cluster operator rotates a connector credential through the UI', async ({ page }) => {+ test.setTimeout(300_000)+ requireRecorderConfirm(+ 'QA_RECORDER_CONFIRM_MUTATIONS',+ 'Human demo: stages a Secret-backed managed connector, rotates its credential through the UI, then deletes them.'+ )+ assertAllowedTarget('CONTROL_UI_URL', CONTROL_UI_URL)+ assertAllowedTarget('CONTROL_API_URL', CONTROL_API_URL)++ const credentials = adminCredentials()+ const contextName = uniqueE2EName('demo-context')+ const connectorName = uniqueE2EName('demo-connector')+ const secretName = uniqueE2EName('demo-secret')+ const secretKey = 'api-key'+ const envVar = 'DEMO_API_KEY'++ try {+ await test.step('sign in through the Control UI', async () => {+ await loginThroughUi(page, credentials)+ await humanPause(page)+ })++ await test.step('stage a managed connector + Secret (API preconditions)', async () => {+ const s = await api(page.request, 'POST', '/api/v1/admin/mcp-secrets', {+ name: secretName,+ data: { [secretKey]: 'initial-value-123' },+ })+ expect(s.status, `Secret: ${JSON.stringify(s.data)}`).toBeLessThan(300)+ const c = await api(page.request, 'POST', '/api/v1/admin/contexts', {+ metadata: { name: contextName },+ spec: { contextId: contextName, description: 'demo rotation context', mcpServers: [] },+ })+ expect(c.status, `context: ${JSON.stringify(c.data)}`).toBeLessThan(300)+ const srv = await api(page.request, 'POST', '/api/v1/admin/mcp-servers', {+ metadata: { name: connectorName },+ spec: {+ image: MOCK_MCP_IMAGE,+ contextRef: contextName,+ description: 'issue #223 credential-rotation demo connector',+ transport: {+ type: 'streamableHttp',+ url: `http://${connectorName}.mcp-server.svc.cluster.local:3000/mcp`,+ port: 3000,+ },+ healthCheck: { port: 3001 },+ envSecret: { name: secretName, keys: [{ secretKey, envVar }] },+ enabled: true,+ },+ })+ expect(srv.status, `connector: ${JSON.stringify(srv.data)}`).toBeLessThan(300)+ })++ await test.step('navigate: sidebar "Connectors" -> connectors list', async () => {+ await humanClick(page, page.getByRole('link', { name: 'Connectors', exact: true }))+ await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })+ await humanPause(page)+ })++ await test.step('expand the connector row and open its Edit screen', async () => {+ const expandBtn = page.getByRole('button', { name: `Expand connector ${connectorName}` })+ await expect(expandBtn).toBeVisible({ timeout: 30_000 })+ await humanClick(page, expandBtn)+ await humanClick(+ page,+ page.getByRole('button', { name: `Edit connector ${connectorName}` })+ )+ await expect(+ page.getByRole('heading', { name: `Edit Connector: ${connectorName}`, exact: true })+ ).toBeVisible({ timeout: 20_000 })+ await humanPause(page)+ })++ await test.step('scroll to "Update credentials" and read the key mapping', async () => {+ await humanReveal(page, page.getByText('Update credentials', { exact: true }))+ const input = page.locator(`#mcp-cred-${secretKey}`)+ await expect(input).toBeVisible({ timeout: 20_000 })+ // Names-only: masked, empty input; the screen never shows a stored value.+ await expect(input).toHaveAttribute('type', 'password')+ await expect(input).toHaveValue('')+ await humanPause(page)+ })++ await test.step('type the new credential value', async () => {+ await humanType(page, page.locator(`#mcp-cred-${secretKey}`), 'rotated-demo-value-456')+ })++ await test.step('rotate & confirm the restart', async () => {+ await humanClick(+ page,+ page.getByRole('button', { name: 'Rotate credentials', exact: true })+ )+ const dialog = page.getByRole('alertdialog', { name: 'Rotate credentials' })+ await expect(dialog).toBeVisible({ timeout: 20_000 })+ await humanPause(page)+ await humanClick(+ page,+ dialog.getByRole('button', { name: 'Rotate & restart', exact: true })+ )+ })++ await test.step('watch the rollout reach "Credentials rotated"', async () => {+ await expect(page.getByText(/Rotating credentials/)).toBeVisible({ timeout: 20_000 })+ await expect(page.getByText(/Credentials rotated\./)).toBeVisible({ timeout: 185_000 })+ // The transitory-False -> failure defect (B1) must not appear.+ await expect(page.getByText(/Rotation failed:/)).toHaveCount(0)+ // Linger on the success banner so the recording clearly shows it.+ await humanPause(page, 3000, 4000)+ })+ } finally {+ await api(+ page.request,+ 'DELETE',+ `/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`+ )+ await api(+ page.request,+ 'DELETE',+ `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`+ )+ await api(page.request, 'DELETE', `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`)+ }+ })+})diff --git a/control-ui/e2e/support/human.ts b/control-ui/e2e/support/human.tsnew file mode 100644index 000000000..528771418--- /dev/null+++ b/control-ui/e2e/support/human.ts@@ -0,0 +1,63 @@+// Human-pacing helpers for recorded QA/demo runs (human-e2e-recorder skill).+// Not for correctness waits — Playwright auto-waiting handles those. These add+// visible mouse movement, deliberate pauses, and char-by-char typing so a+// recorded video reads like a person driving the UI. Speed is env-driven+// (HUMAN_E2E_SPEED); the runner also injects launchOptions.slowMo via the config.+import type { Locator, Page } from '@playwright/test'++type Speed = 'fast' | 'normal' | 'demo' | 'slow'+const SPEED: Speed = (process.env.HUMAN_E2E_SPEED as Speed) || 'demo'++const TYPE_DELAY: Record<Speed, [number, number]> = {+ fast: [25, 80],+ normal: [40, 120],+ demo: [80, 180],+ slow: [120, 260],+}+const PAUSE: Record<Speed, [number, number]> = {+ fast: [150, 350],+ normal: [300, 700],+ demo: [600, 1200],+ slow: [1000, 1800],+}++// Deterministic-enough jitter without Math.random reproducibility concerns:+// recordings don't need reproducibility, only human-looking variation.+function rand(min: number, max: number): number {+ return Math.floor(min + Math.random() * Math.max(1, max - min))+}++export async function humanPause(page: Page, min?: number, max?: number): Promise<void> {+ const [lo, hi] = PAUSE[SPEED]+ await page.waitForTimeout(rand(min ?? lo, max ?? hi))+}++export async function humanMouseMove(page: Page, target: Locator): Promise<void> {+ const box = await target.boundingBox()+ if (!box) return+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 20 })+}++export async function humanClick(page: Page, target: Locator): Promise<void> {+ await target.scrollIntoViewIfNeeded()+ await humanMouseMove(page, target)+ await humanPause(page, 150, 350)+ await target.click()+ await humanPause(page)+}++export async function humanType(page: Page, target: Locator, text: string): Promise<void> {+ await target.scrollIntoViewIfNeeded()+ await humanMouseMove(page, target)+ await target.click()+ await humanPause(page, 120, 260)+ const [lo, hi] = TYPE_DELAY[SPEED]+ await target.pressSequentially(text, { delay: rand(lo, hi) })+ await humanPause(page)+}++export async function humanReveal(page: Page, target: Locator): Promise<void> {+ await target.scrollIntoViewIfNeeded()+ await humanMouseMove(page, target)+ await humanPause(page)+}diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex b3190ec7c..a6c0cd8e6 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.367",+ "version": "0.1.368","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.367",+ "version": "0.1.368","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex e7cd2f3ec..4785f48c7 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.367",+ "version": "0.1.368","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",