test(web): support exact preview browser checks

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
XiaoSeS 2026-09-09 18:32:24 +08:00
parent 5cdbc8c7ec
commit 337cbd935c
2 changed files with 15 additions and 7 deletions

View file

@ -34,12 +34,16 @@ test.describe('Landing access methods (Real API)', () => {
test('agent views expose Registry configuration and implicit discovery', async ({ page }) => {
await page.goto('/')
const origin = new URL(page.url()).origin
const registryTab = page.getByRole('tab', { name: 'Registry setup' })
const discoveryTab = page.getByRole('tab', { name: 'Implicit discovery' })
await expect(registryTab).toHaveAttribute('aria-selected', 'true')
await expect(page.getByText(/registry\/skill\.md/).first()).toBeVisible()
await expect(
page.getByText(`${origin}/registry/skill.md`, { exact: true }),
).toBeVisible()
await discoveryTab.click()
await expect(discoveryTab).toHaveAttribute('aria-selected', 'true')

View file

@ -9,6 +9,8 @@ const mergedNoProxy = Array.from(new Set([
process.env.NO_PROXY = mergedNoProxy
process.env.no_proxy = mergedNoProxy
const externalBaseUrl = process.env.PLAYWRIGHT_BASE_URL
const baseURL = externalBaseUrl ?? 'http://127.0.0.1:3000'
export default defineConfig({
testDir: './e2e',
@ -19,7 +21,7 @@ export default defineConfig({
workers: Number(process.env.PLAYWRIGHT_WORKERS ?? 1),
reporter: 'html',
use: {
baseURL: 'http://127.0.0.1:3000',
baseURL,
trace: 'on-first-retry',
screenshot: 'on',
},
@ -29,10 +31,12 @@ export default defineConfig({
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: 'pnpm exec vite --host 127.0.0.1 --port 3000 --strictPort',
url: 'http://127.0.0.1:3000',
reuseExistingServer: true,
timeout: 120000,
},
webServer: externalBaseUrl
? undefined
: {
command: 'pnpm exec vite --host 127.0.0.1 --port 3000 --strictPort',
url: baseURL,
reuseExistingServer: true,
timeout: 120000,
},
})