Skip to content

Commit 77f7003

Browse files
committed
test(org): press a shortcut only once hydration can answer it
The listeners attach on hydration while the field and the collapsed attribute are server-rendered, so a key straight after load reached nothing. The sidebar's Mod+B check made the same assumption and had yet to lose the race.
1 parent ad1b477 commit 77f7003

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎apps/sim/scripts/org-redesign-e2e/checks/settings.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,11 @@ export async function settingsChecks() {
337337
await page.goto(orgUrl('/settings/members'))
338338
const rail = sidebar(page)
339339
const field = rail.getByRole('searchbox', { name: 'Search settings' })
340-
await page.keyboard.press('/')
341-
await expect(field).toBeFocused()
340+
// Answered from hydration on, which the server-rendered field does not wait for.
341+
await expect(async () => {
342+
await page.keyboard.press('/')
343+
await expect(field).toBeFocused({ timeout: 1_000 })
344+
}).toPass({ timeout: 20_000 })
342345
await field.fill('password')
343346
await rail.getByRole('link', { name: 'Reset password', exact: true }).click()
344347
await expect(page).toHaveURL(orgUrl('/settings/general'))

‎apps/sim/scripts/org-redesign-e2e/checks/sidebar.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export async function sidebarChecks() {
124124
)
125125
await page.reload()
126126
await expect(rail).toHaveAttribute('data-collapsed', 'true')
127+
// The server renders the attribute, so only this says the shortcut is listening.
128+
await expect(composer(page)).toBeFocused()
127129
await page.locator('body').click({ position: { x: 700, y: 20 } })
128130
await page.keyboard.press('Control+b')
129131
await expect(rail).not.toHaveAttribute('data-collapsed', 'true')

0 commit comments

Comments
 (0)