Skip to content

Commit b204668

Browse files
test(dashboard): Exempt the Lead refresh and wait for the palette's Automations (#4061)
1 parent 43c2a84 commit b204668

4 files changed

Lines changed: 13 additions & 16 deletions

File tree

‎packages/junior-dashboard/e2e/conversation-archive.spec.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,6 @@ test("confirms a child archive and archives its children too", async ({
210210
response.request().method() === "PATCH" &&
211211
response.url().endsWith("/archive"),
212212
);
213-
// The Conversations page that the archive returns to reads the Lead.
214-
const leadRead = page.waitForResponse(
215-
(response) => new URL(response.url()).pathname === "/api/lead",
216-
);
217213
await confirm.getByRole("button", { name: "Archive" }).click();
218214
expect((await archived).request().postDataJSON()).toMatchObject({
219215
applyToChildren: true,
@@ -222,7 +218,6 @@ test("confirms a child archive and archives its children too", async ({
222218
await expect(page).toHaveURL(
223219
new URL("/conversations", dashboard.baseURL).href,
224220
);
225-
await leadRead;
226221
});
227222

228223
test("shows why a child restore is refused", async ({ page, dashboard }) => {

‎packages/junior-dashboard/e2e/harness.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ const BACKGROUND_READS: readonly RegExp[] = [
9090
/^\/api\/conversations$/,
9191
/^\/api\/inbox-items(\/[^/]+)?$/,
9292
/^\/api\/people\/me\/spend$/,
93+
// The Lead page reads the Lead again each time its transcript gets a new
94+
// last event, from the first load on, to refresh its Watches
95+
// (`useLeadWatchRefresh`). Nothing on screen changes when the Watches stay
96+
// the same, so a test cannot wait for it. The shell's first read of the
97+
// Lead has the same path; the Lead nav item shows its result.
98+
/^\/api\/lead$/,
9399
// A pointer that rests on an Automation row prefetches its page
94100
// (`usePrefetchAutomation`). A Conversation row prefetches its detail.
95101
/^\/api\/automations\/(?!(event-catalog|runs)$)[^/]+(\/executions)?$/,

‎packages/junior-dashboard/e2e/inbox/navigation.spec.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,15 @@ test.describe("new UI", { tag: "@new" }, () => {
340340
await expect(page).toHaveURL(`${dashboard.baseURL}/automations`);
341341
await listRead;
342342

343-
// The pane's search bar opens the command palette.
343+
// The pane's search bar opens the command palette, which reads the
344+
// viewer's Automations when it opens.
344345
await page.getByRole("button", { name: /^Search/ }).click();
345346
await expect(
346-
page.getByRole("dialog", { name: "Go to conversation" }),
347+
page
348+
.getByRole("dialog", { name: "Go to conversation" })
349+
.getByRole("group", { name: "Automations" })
350+
.getByRole("option")
351+
.first(),
347352
).toBeVisible();
348353
});
349354

‎packages/junior-dashboard/e2e/lead-home.spec.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,22 +265,13 @@ test.describe("on a touch screen", () => {
265265
dashboard,
266266
}) => {
267267
await page.setViewportSize(mobile);
268-
const leadRead = () =>
269-
page.waitForResponse(
270-
(response) => new URL(response.url()).pathname === "/api/lead",
271-
);
272-
const homeRead = leadRead();
273268
await page.goto(dashboard.baseURL);
274269
const entries = page.getByRole("navigation", { name: "Primary" });
275270
await expect(entries.getByRole("link").first()).toHaveText("Lead");
276-
await homeRead;
277-
// The Lead page reads the Lead again once its transcript loads.
278-
const leadRefreshed = leadRead();
279271
await entries.getByRole("link", { name: "Lead", exact: true }).click();
280272
await expect(
281273
page.getByLabel("Conversation transcript").getByText(LEAD_REPLY),
282274
).toBeVisible();
283-
await leadRefreshed;
284275
});
285276

286277
test("the navigation sheet lists the Lead @classic", async ({

0 commit comments

Comments
 (0)