cloudaxe-opencode/packages/app/e2e/projects/projects-switch.spec.ts

36 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

import { test, expect } from "../fixtures"
2026-02-03 23:45:49 +00:00
import { defocus, createTestProject, cleanupTestProject } from "../actions"
import { projectSwitchSelector } from "../selectors"
import { dirSlug } from "../utils"
2026-02-03 23:45:49 +00:00
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)
try {
2026-02-03 23:45:49 +00:00
await withProject(
async ({ directory }) => {
await defocus(page)
2026-02-03 23:45:49 +00:00
const currentSlug = dirSlug(directory)
const otherButton = page.locator(projectSwitchSelector(otherSlug)).first()
await expect(otherButton).toBeVisible()
await otherButton.click()
2026-02-03 23:45:49 +00:00
await expect(page).toHaveURL(new RegExp(`/${otherSlug}/session`))
2026-02-03 23:45:49 +00:00
const currentButton = page.locator(projectSwitchSelector(currentSlug)).first()
await expect(currentButton).toBeVisible()
await currentButton.click()
2026-02-03 23:45:49 +00:00
await expect(page).toHaveURL(new RegExp(`/${currentSlug}/session`))
},
{ extra: [other] },
)
} finally {
await cleanupTestProject(other)
}
})