mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
test(app): stabilize session routing and workspace e2e
This commit is contained in:
@@ -491,11 +491,9 @@ export async function waitSession(page: Page, input: { directory: string; sessio
|
||||
if (!resolved || resolved.directory !== target) return false
|
||||
const current = sessionIDFromUrl(page.url())
|
||||
if (input.sessionID && current !== input.sessionID) return false
|
||||
if (!input.sessionID && current) return false
|
||||
|
||||
const state = await probeSession(page)
|
||||
if (input.sessionID && (!state || state.sessionID !== input.sessionID)) return false
|
||||
if (!input.sessionID && state?.sessionID) return false
|
||||
if (state?.dir) {
|
||||
const dir = await resolveDirectory(state.dir, input.serverUrl).catch(() => state.dir ?? "")
|
||||
if (dir !== target) return false
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
clickMenuItem,
|
||||
confirmDialog,
|
||||
openSidebar,
|
||||
openProjectMenu,
|
||||
openWorkspaceMenu,
|
||||
resolveSlug,
|
||||
setWorkspacesEnabled,
|
||||
@@ -125,21 +124,7 @@ test("non-git projects keep workspace mode disabled", async ({ page, project })
|
||||
|
||||
await openSidebar(page)
|
||||
await expect(page.getByRole("button", { name: "New workspace" })).toHaveCount(0)
|
||||
|
||||
const trigger = page.locator('[data-action="project-menu"]').first()
|
||||
const hasMenu = await trigger
|
||||
.isVisible()
|
||||
.then((x) => x)
|
||||
.catch(() => false)
|
||||
if (!hasMenu) return
|
||||
|
||||
const menu = await openProjectMenu(page, nonGitSlug)
|
||||
|
||||
const toggle = menu.locator('[data-action="project-workspaces-toggle"]').first()
|
||||
|
||||
await expect(toggle).toBeVisible()
|
||||
await expect(toggle).toBeDisabled()
|
||||
await expect(menu.getByRole("menuitem", { name: "New workspace" })).toHaveCount(0)
|
||||
await expect(page.getByRole("button", { name: "Create Git repository" })).toBeVisible()
|
||||
} finally {
|
||||
await cleanupTestProject(nonGit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user