Skip to content

Commit a488518

Browse files
committed
test(org): wait for a removed recent's deletes before reloading
The chip leaves optimistically while its visits are deleted one at a time, so the reload aborted the rest and the chip came back. Assert the row holds only the other source first, which also proves every visit went.
1 parent 67e1d46 commit a488518

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • apps/sim/scripts/org-redesign-e2e/checks

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,14 @@ export async function homeChecks() {
405405
await channelChip.hover()
406406
await recents.getByRole('button', { name: 'Remove #candidates from recents' }).click()
407407
await expect(links).toHaveCount(1)
408+
// The chip leaves at once and its visits are deleted one by one; a reload would abort that.
409+
await expect
410+
.poll(async () => {
411+
const [after] =
412+
await sql`select sources from organization_search_history where user_id = ${MEMBER.userId} and organization_id = ${ORGANIZATION_ID}`
413+
return after?.sources.map((source: { url: string }) => source.url)
414+
})
415+
.toEqual([sources[2].url])
408416
await page.reload()
409417
await expect(homeRegion(page, 'Email')).toBeVisible()
410418
await session.settle()

0 commit comments

Comments
 (0)