Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions scripts/screenshots/journeys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ async function journey(name, steps) {
}
}

/** Waits until the page's height has held for five frames in a row (a list re-rendering after a refetch). */
async function steadyHeight(page) {
await page.waitForFunction(
() =>
new Promise((resolve) => {
let last = -1
let same = 0
const tick = () => {
const h = document.documentElement.scrollHeight
same = h === last ? same + 1 : 0
last = h
if (same >= 5) resolve(true)
else requestAnimationFrame(tick)
}
requestAnimationFrame(tick)
}),
null,
{ timeout: 10000 },
)
}

function expect(condition, message) {
if (!condition) throw new Error(message)
}
Expand Down Expand Up @@ -667,6 +688,13 @@ await journey('delete-a-project', async ({ page, shot }) => {
await confirm.click()
await page.waitForURL((url) => url.pathname === `/${org}`, { timeout: 15000 })
await page.getByRole('status').getByText(`Deleted ${victim.name}`).waitFor()
// The organization's page re-renders once its projects come back without the deleted one: wait for the table to list
// them and the page's height to hold, or the full-page shot catches it mid-relayout at the viewport's height (4 Dec
// 2026, build 619).
const table = page.locator('table.tbl')
await table.locator(`a[href="/${org}/${projects.find((p) => p.slug !== victim.slug).slug}"]`).first().waitFor()
await table.locator(`a[href="/${org}/${victim.slug}"]`).first().waitFor({ state: 'detached' })
await steadyHeight(page)
await shot('deleted')
const after = (await api(page, `/api/ui/orgs/${org}`)).projects
expect(!after.some((p) => p.slug === victim.slug), `the organization still lists ${victim.slug}`)
Expand Down
Loading