From f5a517a307ab900e9623116a94312334f6cefaa0 Mon Sep 17 00:00:00 2001 From: Fran McDade <18710366+frano-m@users.noreply.github.com> Date: Thu, 14 May 2026 14:32:54 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20flaky=20download=20file=20manifest=20e2e?= =?UTF-8?q?=20=E2=80=94=20wait=20for=20nav=20(#4828)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e2e/anvil/anvil-dataset.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2e/anvil/anvil-dataset.spec.ts b/e2e/anvil/anvil-dataset.spec.ts index 6b0ebe84b..2b63fbed4 100644 --- a/e2e/anvil/anvil-dataset.spec.ts +++ b/e2e/anvil/anvil-dataset.spec.ts @@ -107,6 +107,13 @@ describe("Dataset", () => { // Confirm file manifest export method is visible and click it. await clickCard(page, TITLE_TEXT_REQUEST_FILE_MANIFEST); + // Wait for navigation to the manifest page before asserting the button — + // without this, the destination-page locator can poll an unmounted page + // for 15s and fail with "0 elements" even though the click succeeded. + await page.waitForURL((url) => + url.pathname.endsWith(ROUTES.MANIFEST_DOWNLOAD) + ); + // Confirm the file manifest page is loaded: check there is one button to request the manifest. const buttons = page.locator(`${MUI_CLASSES.BUTTON}`, { hasText: BUTTON_TEXT_REQUEST_LINK, @@ -146,6 +153,11 @@ describe("Dataset", () => { // Confirm Terra export method is visible and click it. await clickCard(page, TITLE_TEXT_ANALYZE_IN_TERRA); + // Wait for navigation to the Terra page before asserting the form — same + // defence as the manifest test above; the locator can otherwise poll an + // unmounted page for 15s and fail even though the click succeeded. + await page.waitForURL((url) => url.pathname.endsWith(ROUTES.TERRA)); + // Confirm the analyze in Terra page is loaded: check for form elements. await expect(page.locator(MUI_CLASSES.FORM_CONTROL).first()).toBeVisible(); });