Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

test(applications): await stage readiness after held writes settle

Amruth Pillai2987b27daffa
diff --git a/tests/e2e/specs/applications-keyboard-triage.spec.ts b/tests/e2e/specs/applications-keyboard-triage.spec.ts
index 8c96e7619..b30544ca6 100644
--- a/tests/e2e/specs/applications-keyboard-triage.spec.ts
+++ b/tests/e2e/specs/applications-keyboard-triage.spec.ts
@@ -66,6 +66,7 @@ test("focused triage persists canonical stages/contact, suppresses repeats, keep
await expect.poll(async () => (await read()).status).toBe("applied");
await page.getByRole("button", { name: "Undo", exact: true }).click();
await expect(row).toContainText("Applied");
+ await page.mouse.move(0, 0);
expect((await read()).activity).toEqual(before.activity);
for (const [key, status] of [
["5", "offer"],
diff --git a/tests/e2e/specs/senior-tailoring.spec.ts b/tests/e2e/specs/senior-tailoring.spec.ts
index 373f2ba64..d67b52114 100644
--- a/tests/e2e/specs/senior-tailoring.spec.ts
+++ b/tests/e2e/specs/senior-tailoring.spec.ts
@@ -366,9 +366,10 @@ for (const outcome of ["saved", "failed"] as const)
await page.getByRole("checkbox", { name: /at Elm Co/ }).click();
await page.getByRole("button", { name: "Move to…" }).click();
await page.getByRole("menuitem", { name: "Offer" }).click();
- await expect(page.getByText("1 application moved to Offer")).toBeVisible();
+ await expect(page.getByText("1 application moved to Offer")).toHaveCount(0);
expect(heldWrites).toBe(1);
release();
+ await expect(page.getByText("1 application moved to Offer")).toBeVisible();
// A longer connection-error toast can appear under the pointer and pause the Undo countdown.
await page.mouse.move(0, 0);
diff --git a/tests/e2e/specs/stage-writes-before-bulk.spec.ts b/tests/e2e/specs/stage-writes-before-bulk.spec.ts
index d531a601d..f304b80b3 100644
--- a/tests/e2e/specs/stage-writes-before-bulk.spec.ts
+++ b/tests/e2e/specs/stage-writes-before-bulk.spec.ts
@@ -54,12 +54,11 @@ async function openWorkspace(page: Page, role: string) {
await expect(page.getByRole("heading", { name: "Review checks", exact: true })).toBeVisible();
}
-async function bulkMove(page: Page, company: string, stage: string) {
+async function chooseBulkMove(page: Page, company: string, stage: string) {
await page.getByRole("link", { name: "Applications", exact: true }).click();
await page.getByRole("checkbox", { name: new RegExp(`at ${company}`) }).click();
await page.getByRole("button", { name: "Move to…" }).click();
await page.getByRole("menuitem", { name: stage }).click();
- await expect(page.getByText(`1 application moved to ${stage}`)).toBeVisible();
}
const changedToast = (page: Page) =>
@@ -73,9 +72,12 @@ for (const outcome of ["continue", "fail"] as const)
await openWorkspace(page, "Platform lead");
const submit = await hold(page, "career/submitApplication");
await page.getByRole("button", { name: "Mark as applied", exact: true }).click();
- await bulkMove(page, "Fir Co", "Interview");
+ await chooseBulkMove(page, "Fir Co", "Interview");
expect(submit.held()).toBe(1);
+ await expect(page.getByText("1 application moved to Interview")).toHaveCount(0);
submit.release(outcome);
+ await expect(page.getByText("1 application moved to Interview")).toBeVisible();
+ await page.mouse.move(0, 0);
await expect.poll(async () => (await read(page, id)).status, { timeout: 15_000 }).toBe("interview");
expect(await stages(page, id)).toEqual(
@@ -90,10 +92,13 @@ test("a move made elsewhere after Mark as applied still wins over the bulk move"
const submit = await hold(page, "career/submitApplication");
const bulk = await hold(page, "applications/bulkUpdate");
await page.getByRole("button", { name: "Mark as applied", exact: true }).click();
- await bulkMove(page, "Gum Co", "Interview");
+ await chooseBulkMove(page, "Gum Co", "Interview");
+ await expect(page.getByText("1 application moved to Interview")).toHaveCount(0);
const answered = page.waitForResponse((response) => response.url().includes("/career/submitApplication"));
submit.release("continue");
await answered;
+ await expect(page.getByText("1 application moved to Interview")).toBeVisible();
+ await page.mouse.move(0, 0);
// Another device moves it away and back before the bulk move reaches the server.
await api(page, "put", `/applications/${id}`, { status: "screening" });
await api(page, "put", `/applications/${id}`, { status: "applied" });
@@ -138,8 +143,10 @@ for (const outcome of ["continue", "fail", "undo"] as const)
await page.getByRole("button", { name: "Undo", exact: true }).click();
}
await expect.poll(() => reply.held()).toBe(1);
- await bulkMove(page, "Hazel Co", "Offer");
+ await chooseBulkMove(page, "Hazel Co", "Offer");
+ await expect(page.getByText("1 application moved to Offer")).toHaveCount(0);
reply.release(outcome === "fail" ? "fail" : "continue");
+ await expect(page.getByText("1 application moved to Offer")).toBeVisible();
// Keep the pointer outside notifications so a connection-error toast cannot pause the Undo countdown.
await page.mouse.move(0, 0);