test(web): verify keyboard file navigation and capture preview

This commit is contained in:
Dudu-0223 committed 2026-09-15 16:22:03 +08:00
1 parent 1ec62afbdb
commit 7bc0154bfc
1 file changed
+7 -1
+7 -1
View File
@@ -34,6 +34,7 @@ describe('web e2e: Markdown file links', () => {
await page.locator('[role="treeitem"]').first().click()
await page.locator('[role="treeitem"]').nth(1).click()
await page.getByRole('button', { name: 'Source at line 24', exact: true }).waitFor()
await page.getByRole('button', { name: 'Collapse sidebar', exact: true }).click()
}, 120_000)
afterAll(async () => {
@@ -52,12 +53,17 @@ describe('web e2e: Markdown file links', () => {
await expect.poll(() => column.locator('[data-textpreview-target="24"]').textContent()).toBe('source line 24\n')
await expect.poll(() => column.locator('[data-textpreview-path]').textContent())
.toBe(join(scaffold.workspaceCwd, 'src/example.txt'))
await page.getByRole('button', { name: 'Absolute at line 30', exact: true }).click()
const absolute = page.getByRole('button', { name: 'Absolute at line 30', exact: true })
await absolute.focus()
await absolute.press('Enter')
await expect.poll(() => column.locator('[data-textpreview-target="30"]').textContent()).toBe('source line 30\n')
expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt'])
expect(page.url()).toBe(beforeUrl)
expect(page.context().pages()).toHaveLength(1)
expect(await page.getByRole('link', { name: 'Website', exact: true }).getAttribute('target')).toBe('_blank')
const artifacts = fileURLToPath(new URL('../../../.artifacts', import.meta.url))
await mkdir(artifacts, { recursive: true })
await page.screenshot({ path: join(artifacts, 'markdown-file-links.png') })
await page.getByRole('button', { name: 'Other example', exact: true }).click()
await expect.poll(() => column.locator('[data-textpreview-path]').textContent())
.toBe(join(scaffold.workspaceCwd, 'other/example.txt'))