test(web): align menu expectations and await workspace readiness

This commit is contained in:
Yichen Jiang
2026-11-03 22:44:39 +08:00
parent 0e8bfc1b9d
commit c4ecee9173
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -36,8 +36,8 @@ describe.skipIf(MODE === 'record')('web e2e: default Workspace', () => {
await input.waitFor()
// Language-neutral on disk, localized in the hero chip. The chip's
// aria-label is its fixed call to action, so the label is its text.
await expect.poll(() => page.getByRole('button', { name: 'Choose workspace', exact: true }).textContent())
.toBe('Default workspace')
await page.getByRole('button', { name: 'Choose workspace', exact: true })
.getByText('Default workspace', { exact: true }).waitFor()
expect(scaffold.ctx.workspaceRegistry.list()).toHaveLength(1)
const initialSession = scaffold.ctx.sessions.list()[0]!
expect(scaffold.ctx.sessions.list()).toHaveLength(1)
@@ -82,7 +82,7 @@ describe.skipIf(MODE === 'record')('web e2e: default Workspace', () => {
})
await page.goto(scaffold.authenticatedUrl)
const trigger = page.getByRole('button', { name: 'Choose workspace', exact: true })
await expect.poll(() => trigger.textContent()).toBe('Default workspace')
await trigger.getByText('Default workspace', { exact: true }).waitFor()
await trigger.tap()
const menu = page.getByRole('menu').filter({ has: page.getByRole('menuitem', { name: 'Default workspace', exact: true }) })
await menu.waitFor({ state: 'visible', timeout: 10_000 })
+1 -1
View File
@@ -9,7 +9,7 @@ const cases = [
{ name: 'above placement near the desktop titlebar', side: 'top', align: 'start', x: 120, y: 110, width: 160, height: 80, left: 120, top: 142, clearance: 60 },
{ name: 'below placement near the bottom edge', side: 'bottom', align: 'start', x: 120, y: 330, width: 160, height: 100, left: 120, top: 226, clearance: 12 },
{ name: 'right placement near the right edge', side: 'right', align: 'start', x: 540, y: 100, width: 160, height: 100, left: 376, top: 100, clearance: 12 },
{ name: 'window fallback when neither vertical side fits', side: 'bottom', align: 'start', x: 120, y: 180, width: 300, height: 320, left: 12, top: 60, clearance: 60 },
{ name: 'window fallback retains horizontal anchoring when neither vertical side fits', side: 'bottom', align: 'start', x: 120, y: 180, width: 300, height: 320, left: 120, top: 60, clearance: 60 },
] as const
type Placement = (typeof cases)[number]