mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-04 02:33:47 +10:00
test: avoid awaiting blocked builder navigation
This commit is contained in:
@@ -41,11 +41,12 @@ test("retries a failed autosave before leaving the builder", async ({ authPage:
|
||||
await release.promise;
|
||||
await route.continue();
|
||||
});
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
const navigation = page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
await arrived.promise;
|
||||
expect(page.url()).toBe(url);
|
||||
await expect(page.getByLabel("Name", { exact: true })).toHaveValue("Draft recovered before leaving");
|
||||
release.resolve();
|
||||
await navigation;
|
||||
await page.waitForURL(/\/dashboard/);
|
||||
await page.goto(url);
|
||||
await expect(page.getByLabel("Name", { exact: true })).toHaveValue("Draft recovered before leaving");
|
||||
@@ -60,13 +61,14 @@ test("retains the current draft when saving during navigation fails", async ({ a
|
||||
});
|
||||
await page.getByLabel("Name", { exact: true }).fill("Keep unsaved draft");
|
||||
await expect(page.getByText("Your latest changes could not be saved.", { exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
const blockedNavigation = page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
void blockedNavigation.catch(() => undefined);
|
||||
await expect.poll(() => attempts).toBe(2);
|
||||
await expect(page.getByRole("status").filter({ hasText: "Couldn't save" })).toBeVisible();
|
||||
expect(page.url()).toBe(url);
|
||||
await expect(page.getByLabel("Name", { exact: true })).toHaveValue("Keep unsaved draft");
|
||||
await page.unroute(updateUrl);
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click({ noWaitAfter: true });
|
||||
await page.waitForURL(/\/dashboard/);
|
||||
await page.goto(url);
|
||||
await expect(page.getByLabel("Name", { exact: true })).toHaveValue("Keep unsaved draft");
|
||||
@@ -91,7 +93,8 @@ test("stops waiting for a slow save while preserving late acknowledgements and q
|
||||
await page.getByLabel("Name", { exact: true }).fill("Slow save draft");
|
||||
await page.clock.fastForward(600);
|
||||
await arrived.promise;
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
const blockedNavigation = page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
void blockedNavigation.catch(() => undefined);
|
||||
await page.clock.fastForward(10000);
|
||||
const slowNotice = page.getByText("Saving is taking longer than expected. Your changes are still open.", {
|
||||
exact: true,
|
||||
@@ -114,7 +117,7 @@ test("stops waiting for a slow save while preserving late acknowledgements and q
|
||||
await latestSaved;
|
||||
await expect(page.getByRole("status").filter({ hasText: "Saved" })).toBeVisible();
|
||||
await expect(slowNotice).toBeHidden();
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Go to resumes dashboard", exact: true }).click({ noWaitAfter: true });
|
||||
await page.waitForURL(/\/dashboard/);
|
||||
await page.goto(url);
|
||||
await expect(page.getByLabel("Name", { exact: true })).toHaveValue("Slow save draft");
|
||||
|
||||
Reference in New Issue
Block a user