|
1 | 1 | import { test, expect } from "../fixtures" |
2 | | -import { cleanupSession, closeSidebar, hoverSessionItem } from "../actions" |
| 2 | +import { |
| 3 | + cleanupSession, |
| 4 | + cleanupTestProject, |
| 5 | + closeSidebar, |
| 6 | + createTestProject, |
| 7 | + hoverSessionItem, |
| 8 | + openSidebar, |
| 9 | + waitSession, |
| 10 | +} from "../actions" |
3 | 11 | import { projectSwitchSelector } from "../selectors" |
| 12 | +import { dirSlug } from "../utils" |
4 | 13 |
|
5 | 14 | test("collapsed sidebar popover stays open when archiving a session", async ({ page, slug, sdk, gotoSession }) => { |
6 | 15 | const stamp = Date.now() |
@@ -37,3 +46,35 @@ test("collapsed sidebar popover stays open when archiving a session", async ({ p |
37 | 46 | await cleanupSession({ sdk, sessionID: two.id }) |
38 | 47 | } |
39 | 48 | }) |
| 49 | + |
| 50 | +test("open sidebar project popover stays closed after clicking avatar", async ({ page, withProject }) => { |
| 51 | + await page.setViewportSize({ width: 1400, height: 800 }) |
| 52 | + |
| 53 | + const other = await createTestProject() |
| 54 | + const slug = dirSlug(other) |
| 55 | + |
| 56 | + try { |
| 57 | + await withProject( |
| 58 | + async () => { |
| 59 | + await openSidebar(page) |
| 60 | + |
| 61 | + const project = page.locator(projectSwitchSelector(slug)).first() |
| 62 | + const card = page.locator('[data-component="hover-card-content"]') |
| 63 | + |
| 64 | + await expect(project).toBeVisible() |
| 65 | + await project.hover() |
| 66 | + await expect(card.getByText(/recent sessions/i)).toBeVisible() |
| 67 | + |
| 68 | + await page.mouse.down() |
| 69 | + await expect(card).toHaveCount(0) |
| 70 | + await page.mouse.up() |
| 71 | + |
| 72 | + await waitSession(page, { directory: other }) |
| 73 | + await expect(card).toHaveCount(0) |
| 74 | + }, |
| 75 | + { extra: [other] }, |
| 76 | + ) |
| 77 | + } finally { |
| 78 | + await cleanupTestProject(other) |
| 79 | + } |
| 80 | +}) |
0 commit comments