Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/frontend/e2e/api-keys-copy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,28 @@ import { test, expect } from '@playwright/test'
const MCP_KEYS_ROUTE = '/settings?tab=mcp-keys'

test.describe('@smoke api-keys copy buttons (#677, #859)', () => {
test.beforeEach(async ({ context }) => {
test.beforeEach(async ({ context, page }) => {
// Headless browsers gate clipboard read by default — opt in for the test.
await context.grantPermissions(['clipboard-read', 'clipboard-write'])

// #1134: McpKeysTab's onMounted fires POST /api/mcp/keys/ensure-default;
// when no user-scoped key exists it auto-creates "Default MCP Key" and
// opens the "Your MCP API Key is Ready!" modal at an arbitrary point
// mid-test — both modals are `fixed z-10 inset-0`, so the auto-modal
// lands on top and intercepts the Create click. Neutralize the race:
// call ensure-default ourselves, then reload — the remounted page's own
// ensure-default is a guaranteed no-op, so the auto-modal can never
// appear during the test body.
await page.goto(MCP_KEYS_ROUTE)
const token = await page.evaluate(() => localStorage.getItem('token'))
if (token) {
await page.request
.post('/api/mcp/keys/ensure-default', {
headers: { Authorization: `Bearer ${token}` },
})
.catch(() => {})
}
await page.reload()
})

test('Copy Config button writes MCP JSON to clipboard', async ({ page }) => {
Expand Down
10 changes: 6 additions & 4 deletions src/frontend/e2e/smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ test.describe('smoke', () => {
})

test('@smoke operating room page loads', async ({ page }) => {
// #1109/#1134: /operating-room is a legacy redirect to /operations.
// Navigating the old path also covers the redirect itself.
await page.goto('/operating-room')
// Either a queue list, filters, an empty state, or the title.
await expect(
page.getByText(/operating|queue|priority|all types|no items/i).first()
).toBeVisible({ timeout: 10000 })
await expect(page).toHaveURL(/\/operations/, { timeout: 10000 })
await expect(page.getByRole('heading', { name: 'Operations' })).toBeVisible({ timeout: 10000 })
// Tab strip confirms the view mounted (not just the route resolved).
await expect(page.getByRole('button', { name: 'Needs Response' })).toBeVisible()
})

test('@smoke templates page loads', async ({ page }) => {
Expand Down
Loading