Merge pull request 'test(e2e): fix the nearby-schools journey clicking a card it scrolled past' (#152) from fix/nearby-scroll-journey-clicks-offscreen-card into main
Stage (build -> staging -> E2E gate) / prepare (push) Successful in 1s
Stage (build -> staging -> E2E gate) / Build Backend (FastAPI) (push) Successful in 20s
Stage (build -> staging -> E2E gate) / Build Frontend (Next.js) (push) Successful in 1m23s
Stage (build -> staging -> E2E gate) / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 13s
Stage (build -> staging -> E2E gate) / Deploy to Staging (push) Successful in 25s
Stage (build -> staging -> E2E gate) / E2E Journeys against Staging (push) Failing after 2m49s
Stage (build -> staging -> E2E gate) / prepare (push) Successful in 1s
Stage (build -> staging -> E2E gate) / Build Backend (FastAPI) (push) Successful in 20s
Stage (build -> staging -> E2E gate) / Build Frontend (Next.js) (push) Successful in 1m23s
Stage (build -> staging -> E2E gate) / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 13s
Stage (build -> staging -> E2E gate) / Deploy to Staging (push) Successful in 25s
Stage (build -> staging -> E2E gate) / E2E Journeys against Staging (push) Failing after 2m49s
Reviewed-on: #152
This commit was merged in pull request #152.
This commit is contained in:
commit
9dba5ff1ff
1 file changed
+13
-2
@@ -2784,12 +2784,23 @@ test('nearby schools link on to other schools and into compare', async ({ page }
|
||||
|
||||
// The compare hand-off, and the row must not jump back to the start when the
|
||||
// footer re-renders underneath it.
|
||||
//
|
||||
// Click the LAST card's button, not the first. Playwright scrolls a target
|
||||
// into view before clicking it, so clicking card one while the row is paged
|
||||
// to the end scrolls the container back to the start — and the assertion
|
||||
// below then measures Playwright's own scrolling rather than the app's.
|
||||
// That is what this test did on its first staging run: 537 → 2, reproduced
|
||||
// afterwards on a static page with no React on it at all.
|
||||
//
|
||||
// A few pixels of snap or sub-pixel adjustment are fine; a reset to the
|
||||
// start is not, which is the whole point of the check.
|
||||
const offsetBefore = await scroller.evaluate((node: HTMLElement) => node.scrollLeft);
|
||||
await section.getByRole('button', { name: /Add to compare/ }).first().click();
|
||||
await section.getByRole('button', { name: /Add to compare/ }).last().click();
|
||||
await expect(
|
||||
section.getByRole('button', { name: /Added to compare/ }).first(),
|
||||
).toBeVisible();
|
||||
expect(await scroller.evaluate((node: HTMLElement) => node.scrollLeft)).toBe(offsetBefore);
|
||||
const offsetAfter = await scroller.evaluate((node: HTMLElement) => node.scrollLeft);
|
||||
expect(Math.abs(offsetAfter - offsetBefore)).toBeLessThanOrEqual(8);
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user