diff options
| author | Kit Langton <[email protected]> | 2026-04-02 14:17:28 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-02 18:17:28 +0000 |
| commit | c3ef69c8664ab84464d720f75eb9bf35289c1847 (patch) | |
| tree | d7b1aa78355c39472804bdfbbd9db87722d0587b /packages/app/e2e/sidebar | |
| parent | 363891126c9b2a909db0e724eb6377bd3d12b38b (diff) | |
| download | opencode-c3ef69c8664ab84464d720f75eb9bf35289c1847.tar.gz opencode-c3ef69c8664ab84464d720f75eb9bf35289c1847.zip | |
test(app): add a golden path for mocked e2e prompts (#20593)
Diffstat (limited to 'packages/app/e2e/sidebar')
| -rw-r--r-- | packages/app/e2e/sidebar/sidebar-popover-actions.spec.ts | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/packages/app/e2e/sidebar/sidebar-popover-actions.spec.ts b/packages/app/e2e/sidebar/sidebar-popover-actions.spec.ts index 1317d2bb6..05a129a61 100644 --- a/packages/app/e2e/sidebar/sidebar-popover-actions.spec.ts +++ b/packages/app/e2e/sidebar/sidebar-popover-actions.spec.ts @@ -48,70 +48,61 @@ test("collapsed sidebar popover stays open when archiving a session", async ({ p } }) -test("open sidebar project popover stays closed after clicking avatar", async ({ page, withProject }) => { +test("open sidebar project popover stays closed after clicking avatar", async ({ page, project }) => { await page.setViewportSize({ width: 1400, height: 800 }) const other = await createTestProject() const slug = dirSlug(other) try { - await withProject( - async () => { - await openSidebar(page) - - const project = page.locator(projectSwitchSelector(slug)).first() - const card = page.locator('[data-component="hover-card-content"]') - - await expect(project).toBeVisible() - await project.hover() - await expect(card.getByText(/recent sessions/i)).toBeVisible() - - await page.mouse.down() - await expect(card).toHaveCount(0) - await page.mouse.up() - - await waitSession(page, { directory: other }) - await expect(card).toHaveCount(0) - }, - { extra: [other] }, - ) + await project.open({ extra: [other] }) + await openSidebar(page) + + const projectButton = page.locator(projectSwitchSelector(slug)).first() + const card = page.locator('[data-component="hover-card-content"]') + + await expect(projectButton).toBeVisible() + await projectButton.hover() + await expect(card.getByText(/recent sessions/i)).toBeVisible() + + await projectButton.click() + await expect(card).toHaveCount(0) + + await waitSession(page, { directory: other }) + await expect(card).toHaveCount(0) } finally { await cleanupTestProject(other) } }) -test("open sidebar project switch activates on first tabbed enter", async ({ page, withProject }) => { +test("open sidebar project switch activates on first tabbed enter", async ({ page, project }) => { await page.setViewportSize({ width: 1400, height: 800 }) const other = await createTestProject() const slug = dirSlug(other) try { - await withProject( - async () => { - await openSidebar(page) - await defocus(page) - - const project = page.locator(projectSwitchSelector(slug)).first() - - await expect(project).toBeVisible() - - let hit = false - for (let i = 0; i < 20; i++) { - hit = await project.evaluate((el) => { - return el.matches(":focus") || !!el.parentElement?.matches(":focus") - }) - if (hit) break - await page.keyboard.press("Tab") - } - - expect(hit).toBe(true) - - await page.keyboard.press("Enter") - await waitSession(page, { directory: other }) - }, - { extra: [other] }, - ) + await project.open({ extra: [other] }) + await openSidebar(page) + await defocus(page) + + const projectButton = page.locator(projectSwitchSelector(slug)).first() + + await expect(projectButton).toBeVisible() + + let hit = false + for (let i = 0; i < 20; i++) { + hit = await projectButton.evaluate((el) => { + return el.matches(":focus") || !!el.parentElement?.matches(":focus") + }) + if (hit) break + await page.keyboard.press("Tab") + } + + expect(hit).toBe(true) + + await page.keyboard.press("Enter") + await waitSession(page, { directory: other }) } finally { await cleanupTestProject(other) } |
