test(web): wait for sidebar collapse before reopening
This commit is contained in:
1 parent
736730c3fd
commit
6e456264a9
1 file changed
+6
@@ -45,6 +45,12 @@ describe('navigation without a selected Session', () => {
|
||||
if (platform === 'darwin') {
|
||||
expect(await page.locator('[data-conversation-header-leading]').getByRole('button', { name: 'New session', exact: true }).isVisible()).toBe(true)
|
||||
}
|
||||
// The open label precedes both the column slide and the rail's mount animation.
|
||||
// Reverse the pointer action only after the rendered sidebar has settled.
|
||||
const sidebarSettled = () => page.locator('[data-sidebar-collapsed]').evaluate((frame: HTMLElement) =>
|
||||
Number.parseFloat(getComputedStyle(frame).gridTemplateColumns) === Number.parseFloat(frame.style.gridTemplateColumns)
|
||||
&& frame.getAnimations({ subtree: true }).every(animation => animation.playState === 'finished' || animation.playState === 'idle'))
|
||||
await expect.poll(sidebarSettled, { timeout: 30_000 }).toBe(true)
|
||||
await reopen.click()
|
||||
await page.getByRole('button', { name: 'Collapse sidebar', exact: true }).waitFor({ state: 'visible' })
|
||||
expect(await sessionHeader.count()).toBe(0)
|
||||
|
||||
Reference in new issue
Block a user