Skip to content

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

TypeScript

test(control-ui): align connector recorder journey

Alfredo Lopeza8f314f24e24
diff --git a/control-ui/components/CreateMcpServerForm/index.tsx b/control-ui/components/CreateMcpServerForm/index.tsx
index 8b4bbdc81..1b6df4f24 100644
--- a/control-ui/components/CreateMcpServerForm/index.tsx
+++ b/control-ui/components/CreateMcpServerForm/index.tsx
@@ -790,10 +790,12 @@ export function CreateMcpServerForm({
: 'Create a context before creating a connector.'
}
error={contextsError || undefined}
+ htmlFor="create-connector-context"
label="Context"
required
>
<SelectionDropdown
+ ariaLabel="Context"
id="create-connector-context"
multiple={false}
onChange={next => setContextRef(next[0] ?? '')}
diff --git a/control-ui/components/SelectionDropdown/index.tsx b/control-ui/components/SelectionDropdown/index.tsx
index a610fcb3b..6ace59e51 100644
--- a/control-ui/components/SelectionDropdown/index.tsx
+++ b/control-ui/components/SelectionDropdown/index.tsx
@@ -14,6 +14,7 @@ function optionMatches(option: SelectionDropdownOption, query: string): boolean
}
export function SelectionDropdown({
+ ariaLabel,
className,
disabled = false,
emptyLabel = 'No options available.',
@@ -118,6 +119,7 @@ export function SelectionDropdown({
aria-expanded={open}
aria-haspopup="listbox"
aria-invalid={invalid || undefined}
+ aria-label={ariaLabel}
disabled={disabled}
onClick={() => setOpen(current => !current)}
>
diff --git a/control-ui/components/SelectionDropdown/types.ts b/control-ui/components/SelectionDropdown/types.ts
index 19d7b9749..19fed5642 100644
--- a/control-ui/components/SelectionDropdown/types.ts
+++ b/control-ui/components/SelectionDropdown/types.ts
@@ -9,6 +9,7 @@ export type SelectionDropdownOption = {
}
export type SelectionDropdownProps = {
+ ariaLabel?: string
className?: string
id?: string
options: SelectionDropdownOption[]
diff --git a/control-ui/components/__tests__/CreateMcpServerForm.test.tsx b/control-ui/components/__tests__/CreateMcpServerForm.test.tsx
index de743c2a9..c9ea205cd 100644
--- a/control-ui/components/__tests__/CreateMcpServerForm.test.tsx
+++ b/control-ui/components/__tests__/CreateMcpServerForm.test.tsx
@@ -102,7 +102,7 @@ describe('CreateMcpServerForm — render', () => {
await waitFor(() =>
expect(screen.getByRole('heading', { name: 'Context access' })).toBeInTheDocument()
)
- const contextSelector = screen.getByRole('button', { name: 'context1' })
+ const contextSelector = screen.getByRole('button', { name: 'Context' })
fireEvent.click(contextSelector)
expect(screen.getByRole('option', { name: 'context1' })).toBeInTheDocument()
diff --git a/control-ui/e2e/qa-recorder-connector-edit.spec.ts b/control-ui/e2e/qa-recorder-connector-edit.spec.ts
index 2cf4fbc16..70bf87dfd 100644
--- a/control-ui/e2e/qa-recorder-connector-edit.spec.ts
+++ b/control-ui/e2e/qa-recorder-connector-edit.spec.ts
@@ -12,6 +12,7 @@ import {
adminCredentials,
api,
assertAllowedTarget,
+ directApi,
loginThroughUi,
requireRecorderConfirm,
screenshotAndLog,
@@ -24,8 +25,8 @@ import {
// or non-existent image would never converge, only time out.
const MOCK_MCP_IMAGE = process.env.TEST_MOCK_MCP_IMAGE ?? 'clerum/mock-mcp-server:test'
-// The connector-form selects are not label-associated (no htmlFor/id), so use
-// their visible field label as the stable local scope for the select control.
+// The connector-form's Transport Type and Managed selects are not label-associated,
+// so use their visible field label as the stable local scope for those controls.
async function fieldSelect(page: Page, fieldLabelText: string, value: string): Promise<void> {
await page.getByText(fieldLabelText, { exact: true }).locator('..').getByRole('combobox').selectOption(value)
}
@@ -35,7 +36,7 @@ async function createEmptyContext(page: Page, contextName: string): Promise<void
await expect(page).toHaveURL(/\/contexts$/, { timeout: 20_000 })
await page.getByRole('button', { name: 'Create context', exact: true }).click()
await expect(page).toHaveURL(/\/contexts\/new$/, { timeout: 20_000 })
- await page.getByPlaceholder('context1').fill(contextName)
+ await page.getByLabel('Context name').fill(contextName)
await page
.getByPlaceholder('Human-readable context description')
.fill('QA recorder temporary context')
@@ -61,7 +62,8 @@ async function createDiscoveryConnector(
): Promise<void> {
await page.getByRole('link', { name: 'Installed Connectors', exact: true }).click()
await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })
- await page.getByRole('button', { name: 'Create Connector', exact: true }).click()
+ await page.getByRole('button', { name: 'Connector actions', exact: true }).click()
+ await page.getByRole('menuitem', { name: 'Create connector', exact: true }).click()
await expect(page).toHaveURL(/\/connectors\/new$/, { timeout: 20_000 })
await page.getByPlaceholder('my-mcp-server').fill(connectorName)
@@ -72,7 +74,17 @@ async function createDiscoveryConnector(
.getByPlaceholder('Optional description of this connector')
.fill('QA recorder discovery-only connector')
- const contextDropdown = page.locator('.cu-selection-dropdown__button')
+ await page.getByText('Advanced options', { exact: true }).click()
+ await fieldSelect(page, 'Transport Type', 'stdio')
+ await expect(page.locator('input[type="number"]')).toHaveCount(0)
+ await fieldSelect(page, 'Managed', 'false')
+ await page.getByLabel('Egress mode').selectOption('exact-cidr')
+ await page.getByLabel('Allowed CIDRs/IPs').fill('8.8.8.8/32')
+ await page.getByLabel('Allowed ports').fill('443')
+
+ await page.getByRole('button', { name: 'Continue', exact: true }).click()
+
+ const contextDropdown = page.getByRole('button', { name: 'Context', exact: true })
await expect(contextDropdown).toBeEnabled({ timeout: 20_000 })
await contextDropdown.click()
await expect(page.getByPlaceholder('Search contexts...')).toBeVisible({ timeout: 20_000 })
@@ -82,18 +94,10 @@ async function createDiscoveryConnector(
await page.getByRole('button', { name: 'Continue', exact: true }).click()
- await fieldSelect(page, 'Transport Type', 'stdio')
- await expect(page.locator('input[type="number"]')).toHaveCount(0)
- await fieldSelect(page, 'Managed', 'false')
-
- await page.getByRole('button', { name: 'Continue', exact: true }).click()
-
- await expect(page.getByText('External Egress', { exact: true })).toBeVisible({ timeout: 20_000 })
- await page.getByRole('button', { name: 'Continue', exact: true }).click()
-
await expect(
- page.getByRole('checkbox', { name: 'Use Kubernetes Secret for credentials', exact: true })
- ).not.toBeChecked()
+ page.getByRole('radio', { name: /^No credentials required/ })
+ ).toBeVisible({ timeout: 20_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.', { exact: true })).toBeVisible({
@@ -151,7 +155,7 @@ test.describe('optional QA recorder: Control UI connector edit', () => {
// External Egress: switch to exact-CIDR mode and add one public CIDR + port.
// 8.8.8.8/32 is a valid public target; the model rejects private/doc ranges.
- await fieldSelect(page, 'Egress mode', 'exact-cidr')
+ await page.getByLabel('Egress mode').selectOption('exact-cidr')
await page.getByLabel('Allowed CIDRs/IPs').fill('8.8.8.8/32')
await page.getByLabel('Allowed ports').fill('443')
@@ -162,12 +166,16 @@ test.describe('optional QA recorder: Control UI connector edit', () => {
await screenshotAndLog(page, testInfo, 'control-ui-connector-edit')
} finally {
- await api(
+ await directApi(
page.request,
'DELETE',
`/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`
)
- await api(page.request, 'DELETE', `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`)
+ await directApi(
+ page.request,
+ 'DELETE',
+ `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`
+ )
}
})
@@ -308,21 +316,21 @@ test.describe('optional QA recorder: Control UI connector edit', () => {
await screenshotAndLog(page, testInfo, 'control-ui-connector-credential-rotation')
} finally {
- const deleteConnector = await api(
+ const deleteConnector = await directApi(
page.request,
'DELETE',
`/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`
)
expect(deleteConnector.status, 'cleanup connector').toBe(200)
if (!cleanupIdentity) throw new Error('missing cleanup identity')
- const deleteSecret = await api(
+ const deleteSecret = await directApi(
page.request,
'DELETE',
`/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`,
cleanupIdentity
)
expect(deleteSecret.status, 'cleanup connector credential').toBe(200)
- const deleteContext = await api(
+ const deleteContext = await directApi(
page.request,
'DELETE',
`/api/v1/admin/contexts/${encodeURIComponent(contextName)}`
diff --git a/control-ui/e2e/qa-recorder-helpers.ts b/control-ui/e2e/qa-recorder-helpers.ts
index 8723cee18..14d24881f 100644
--- a/control-ui/e2e/qa-recorder-helpers.ts
+++ b/control-ui/e2e/qa-recorder-helpers.ts
@@ -31,6 +31,8 @@ export type ApiResult<T = Record<string, unknown>> = {
status: number
}
+type ApiMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'
+
export type NamedResource = {
metadata?: { name?: string; namespace?: string }
name?: string
@@ -143,18 +145,21 @@ export async function createSecureTempFile(fileName: string, contents: string) {
* browser session's cookies. Pass `page.request` so the admin auth set by
* loginThroughUi is reused.
*/
-export async function api<T = Record<string, unknown>>(
+async function requestApi<T = Record<string, unknown>>(
request: APIRequestContext,
- method: 'GET' | 'POST' | 'PUT' | 'DELETE',
+ baseUrl: string,
+ method: ApiMethod,
pathName: string,
- body?: unknown
+ body?: unknown,
+ timeout?: number
): Promise<ApiResult<T>> {
- const response = await request.fetch(`${CONTROL_UI_URL}/control-api${pathName}`, {
+ const response = await request.fetch(`${baseUrl}${pathName}`, {
method,
headers: {
...(body ? { 'Content-Type': 'application/json' } : {}),
},
data: body,
+ ...(timeout === undefined ? {} : { timeout }),
})
const text = await response.text()
let data = {} as T
@@ -166,6 +171,28 @@ export async function api<T = Record<string, unknown>>(
return { status: response.status(), data }
}
+export async function api<T = Record<string, unknown>>(
+ request: APIRequestContext,
+ method: ApiMethod,
+ pathName: string,
+ body?: unknown
+): Promise<ApiResult<T>> {
+ return requestApi(request, `${CONTROL_UI_URL}/control-api`, method, pathName, body)
+}
+
+/**
+ * Use the Control API directly for cleanup. It shares the browser's localhost
+ * session cookie while keeping teardown on a bounded, explicit request path.
+ */
+export async function directApi<T = Record<string, unknown>>(
+ request: APIRequestContext,
+ method: ApiMethod,
+ pathName: string,
+ body?: unknown
+): Promise<ApiResult<T>> {
+ return requestApi(request, CONTROL_API_URL, method, pathName, body, 30_000)
+}
+
export function resourceName(item: NamedResource): string {
return String(item.name || item.metadata?.name || '').trim()
}