Procházet zdrojové kódy

test(web): align sidebar interaction expectations

imccyu před 1 měsícem
rodič
revize
2f2831f033

+ 6 - 4
apps/web/tests/document-preview.e2e.ts

@@ -130,9 +130,10 @@ describe.skipIf(MODE === 'record')('web e2e: document preview through Files', ()
     expect(await column.locator('[data-dockkit-tab]').count()).toBe(1)
     const defaultTitle = await filesTab.locator('[data-dockkit-tab-title]').innerText()
     const initialFilesClose = await filesTab.locator('[data-dockkit-tab-close]').count()
-    expect(initialFilesClose).toBe(0)
+    expect(initialFilesClose).toBe(1)
     await filesTab.click({ button: 'right' })
-    expect(await page.locator('[data-dockkit-tab-menu]:visible').count()).toBe(0)
+    expect(await page.locator('[data-dockkit-tab-menu]:visible').count()).toBe(1)
+    await page.keyboard.press('Escape')
     await addTab.waitFor({ state: 'visible' })
     const initialAdd = await addTab.count()
     expect(initialAdd).toBe(1)
@@ -143,9 +144,10 @@ describe.skipIf(MODE === 'record')('web e2e: document preview through Files', ()
     const guideClose = await guideTab.locator('[data-dockkit-tab-close]').count()
     const filesCloseWithGuide = await filesTab.locator('[data-dockkit-tab-close]').count()
     expect(guideClose).toBe(1)
-    expect(filesCloseWithGuide).toBe(0)
+    expect(filesCloseWithGuide).toBe(1)
     await expect.poll(() => addTab.count()).toBe(0)
     const addWithGuide = await addTab.count()
+    await guideTab.hover()
     await guideTab.locator('[data-dockkit-tab-close]').click()
     await column.locator('[data-files-state="tree"]').waitFor({ state: 'visible' })
     await expect.poll(() => column.locator('[data-sidebar-right-guide]').count()).toBe(0)
@@ -153,7 +155,7 @@ describe.skipIf(MODE === 'record')('web e2e: document preview through Files', ()
     await addTab.waitFor({ state: 'visible' })
     const restoredFilesClose = await filesTab.locator('[data-dockkit-tab-close]').count()
     const restoredAdd = await addTab.count()
-    expect(restoredFilesClose).toBe(0)
+    expect(restoredFilesClose).toBe(1)
     expect(restoredAdd).toBe(1)
     const preview = column.locator('[data-document-preview]')
     const openFile = async (name: string): Promise<void> => {

+ 2 - 1
apps/web/tests/sidebar-right.e2e.ts

@@ -603,8 +603,8 @@ describe('web e2e: shipped right Sidebar', () => {
       // case collects console errors itself.
       const viewport = page.viewportSize()
       if (viewport === null) throw new Error('expected a fixed viewport')
+      const column = await resetSidebar(page)
       const frame = page.locator('[class*="frame"]').first()
-      const column = page.locator('[data-rightbar-col]')
       const panel = column.locator('[data-sidebar-right-panel]')
       const consoleErrors: string[] = []
       const collect = (message: ConsoleMessage): void => {
@@ -614,6 +614,7 @@ describe('web e2e: shipped right Sidebar', () => {
       try {
         await page.setViewportSize({ width: 1000, height: viewport.height })
         await ensureExpanded(page, column)
+        await width(column)
         const grip = frame.locator('[data-side="rightbar"]')
         // The frame reads the new viewport through a throttled ResizeObserver,
         // a couple of frames after the resize; until then the grip sits at the

+ 1 - 1
snapshots/web/document-preview/document.expected.md

@@ -3,7 +3,7 @@
 ## Sidebar tabs
 
 - Default tab: Files
-- Files close buttons (alone -> with guide -> restored): 0 -> 0 -> 0
+- Files close buttons (alone -> with guide -> restored): 1 -> 1 -> 1
 - Manual guide close buttons: 1
 - Add buttons (Files -> guide -> Files): 1 -> 0 -> 1