summaryrefslogtreecommitdiffhomepage
path: root/packages/app/e2e/projects/projects-switch.spec.ts
diff options
context:
space:
mode:
authorFilip <[email protected]>2026-02-04 00:45:49 +0100
committerGitHub <[email protected]>2026-02-03 17:45:49 -0600
commitacac05f22eb3c23eebea3c13ed0a0f5495425384 (patch)
treed189ec0c52436b3ed91b68f92f1a8365d4a43b7c /packages/app/e2e/projects/projects-switch.spec.ts
parentb5a4671c648fd428425f759f9d487754b425dc75 (diff)
downloadopencode-acac05f22eb3c23eebea3c13ed0a0f5495425384.tar.gz
opencode-acac05f22eb3c23eebea3c13ed0a0f5495425384.zip
refactor(e2e): faster tests (#12021)
Diffstat (limited to 'packages/app/e2e/projects/projects-switch.spec.ts')
-rw-r--r--packages/app/e2e/projects/projects-switch.spec.ts33
1 files changed, 17 insertions, 16 deletions
diff --git a/packages/app/e2e/projects/projects-switch.spec.ts b/packages/app/e2e/projects/projects-switch.spec.ts
index 829ed8e57..a817412cd 100644
--- a/packages/app/e2e/projects/projects-switch.spec.ts
+++ b/packages/app/e2e/projects/projects-switch.spec.ts
@@ -1,33 +1,34 @@
import { test, expect } from "../fixtures"
-import { defocus, createTestProject, seedProjects, cleanupTestProject } from "../actions"
+import { defocus, createTestProject, cleanupTestProject } from "../actions"
import { projectSwitchSelector } from "../selectors"
import { dirSlug } from "../utils"
-test("can switch between projects from sidebar", async ({ page, directory, gotoSession }) => {
+test("can switch between projects from sidebar", async ({ page, withProject }) => {
await page.setViewportSize({ width: 1400, height: 800 })
const other = await createTestProject()
const otherSlug = dirSlug(other)
- await seedProjects(page, { directory, extra: [other] })
-
try {
- await gotoSession()
-
- await defocus(page)
+ await withProject(
+ async ({ directory }) => {
+ await defocus(page)
- const currentSlug = dirSlug(directory)
- const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
- await expect(otherButton).toBeVisible()
- await otherButton.click()
+ const currentSlug = dirSlug(directory)
+ const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
+ await expect(otherButton).toBeVisible()
+ await otherButton.click()
- await expect(page).toHaveURL(new RegExp(`/${otherSlug}/session`))
+ await expect(page).toHaveURL(new RegExp(`/${otherSlug}/session`))
- const currentButton = page.locator(projectSwitchSelector(currentSlug)).first()
- await expect(currentButton).toBeVisible()
- await currentButton.click()
+ const currentButton = page.locator(projectSwitchSelector(currentSlug)).first()
+ await expect(currentButton).toBeVisible()
+ await currentButton.click()
- await expect(page).toHaveURL(new RegExp(`/${currentSlug}/session`))
+ await expect(page).toHaveURL(new RegExp(`/${currentSlug}/session`))
+ },
+ { extra: [other] },
+ )
} finally {
await cleanupTestProject(other)
}