فهرست منبع

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

Dudu-0223 1 هفته پیش
والد
کامیت
7bc0154bfc
1فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 7 1
      apps/web/tests/markdown-file-links.e2e.ts

+ 7 - 1
apps/web/tests/markdown-file-links.e2e.ts

@@ -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'))