From 92308f839d75c6ff50f6668a8e9c28595bccf633 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:08:23 -0600 Subject: [PATCH] test(e2e): use the Coordinator task panel, inbox and plan controls in QA journeys (#21701) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The QA Cloud product journeys check real user paths on a hosted test stack > - #19360 (2026-11-05) made the Coordinator workspace standard; its task side panel starts with no tabs, and the header control opens a tab chooser > - The journeys were written for the classic panel, which opened straight on Properties, and for older inbox and plan controls > - On QA the smoke suite passed 8 of 24 journeys; 13 failures trace to these out-of-date journey steps > - This pull request updates the journeys to use the shipped Coordinator controls the way a person does > - The benefit is that the QA journeys test the product again instead of failing on removed controls ## Linked Issues or Issue Description **What happened?** The QA staging smoke suite passed 8 of 24 journeys. 13 failures come from journey steps that target the classic UI: - Task side panel: the journeys click "Show properties" and expect property rows. In Coordinator the click opens a tab chooser ("Open a side panel tab"), and the user picks Properties or Artifacts. The product's own e2e tests (`tests/e2e/artifact-tab-arrival.spec.ts`, `artifact-uploads.spec.ts`, `disconnect-resilience.spec.ts`) and the chat-catalog runtime cases already use the chooser. - Inbox: desktop Coordinator inbox rows show unread state as a bold title and have no per-row "Mark as read" button (`doc/plans/2026-11-06-chat-contacts-pins.md`). The `r` shortcut marks the hovered row read on the Mine view. - Plan: the Coordinator Plan chip is named "Open Plan revision N in task sidebar", not "Open Plan revision N". **Steps to reproduce** 1. Run `pnpm test:e2e:runner -- --target-config ` with task-properties, task-edit-lifecycle, task-document-persistence and project-task-context. 2. See 0/4 pass on master; each stops at the tab chooser. **Expected behavior** The journeys reach the same saved-state checks as before through the shipped controls. ## What Changed - New `product-journeys/task-panel.ts` helper: opens the side panel and selects a tab (Properties or Artifacts) from the chooser, an open tab, or the "Open a new tab" button. It waits for the page instead of a single non-waiting visibility check, and does not close an already open panel. - task-properties, task-edit-lifecycle, task-dependency-resume, project-task-context and task-document-persistence (and routine/agent journeys that reuse `openDocumentAuthoring`) use the helper. task-properties reopens the panel after reload before it checks "You". - inbox-triage: when the row has no visible "Mark as read" button, open the Mine view, blur search, hover the row and press `r` (as `tests/e2e/coordinator-inbox-views.spec.ts` does). - Plan journey: `planPreviewLabel()` accepts the optional " in task sidebar" suffix and still requires the exact revision. - No product code changes. An earlier revision of this PR changed "Show properties" to select Properties; it is reverted because the product e2e suite asserts the chooser is the intended design. All saved-state assertions are unchanged: assignment, labels, status, documents, read state and plan revision are still read back through the API, so a broken feature still fails. ## Verification - Real browser journeys on a managed local instance against unmodified master UI: 4/4 pass (task-edit-lifecycle, task-properties, task-document-persistence, project-task-context); 0/4 before. - Inbox fallback checked by hand on a local instance: an unread task on the Mine view became `isUnreadForMe=false` after blur + hover + `r`. - `tests/runner-e2e` unit tests for product-journeys and plan-revision: 47 files, 1240 tests pass. The task-properties contract test now models the chooser and asserts the opener and the Properties option are used before assignment and after reload. New `planPreviewLabel` test covers revision 12 vs 1 and a missing revision. - QA Cloud rerun follows once the QA harness pin moves to a master commit that contains this change. ## Risks - Low risk: test code only. If the chooser changes again, the helper fails visibly at the panel step. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 --- tests/runner-e2e/plan-revision-flow.test.ts | 10 ++++- tests/runner-e2e/plan-revision-flow.ts | 6 ++- .../product-journeys/contracts.test.ts | 27 ++++++++++++-- .../product-journeys/inbox-triage-flow.ts | 10 ++++- .../project-context-readback.ts | 5 +-- .../task-dependency-resume.test.ts | 1 + .../task-dependency-resume.ts | 16 +------- .../task-document-flow.test.ts | 2 +- .../product-journeys/task-document-flow.ts | 20 +--------- .../product-journeys/task-lifecycle.ts | 18 +-------- .../runner-e2e/product-journeys/task-panel.ts | 37 +++++++++++++++++++ .../product-journeys/task-properties.ts | 8 ++-- 12 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 tests/runner-e2e/product-journeys/task-panel.ts diff --git a/tests/runner-e2e/plan-revision-flow.test.ts b/tests/runner-e2e/plan-revision-flow.test.ts index 57d55a59897..39322920453 100644 --- a/tests/runner-e2e/plan-revision-flow.test.ts +++ b/tests/runner-e2e/plan-revision-flow.test.ts @@ -1,6 +1,6 @@ import { expect, it, vi } from "vitest"; import type { Page } from "@playwright/test"; -import { runPlanRevisionAcceptance } from "./plan-revision-flow.js"; +import { planPreviewLabel, runPlanRevisionAcceptance } from "./plan-revision-flow.js"; const state = { currentIssue: { status: "in_progress" }, @@ -36,3 +36,11 @@ it("lets deployment callers reject a binding failure without another observation expect(load).toHaveBeenCalledOnce(); expect(get).not.toHaveBeenCalled(); }); + +it("accepts the classic and Coordinator Plan preview names for the exact revision only", () => { + expect(planPreviewLabel(1).test("Open Plan revision 1")).toBe(true); + expect(planPreviewLabel(1).test("Open Plan revision 1 in task sidebar")).toBe(true); + expect(planPreviewLabel(1).test("Open Plan revision 12 in task sidebar")).toBe(false); + expect(planPreviewLabel(2).test("Open Plan revision 1 in task sidebar")).toBe(false); + expect(planPreviewLabel(1).test("Open Plan in task sidebar")).toBe(false); +}); diff --git a/tests/runner-e2e/plan-revision-flow.ts b/tests/runner-e2e/plan-revision-flow.ts index e8d7bd84a7b..553926580bb 100644 --- a/tests/runner-e2e/plan-revision-flow.ts +++ b/tests/runner-e2e/plan-revision-flow.ts @@ -19,11 +19,15 @@ export function isPendingPlanConfirmation(interaction: PlanInteraction) { && typeof interaction.payload.target.revisionId === "string"; } export function normalizePlanMarkdown(body: string | null | undefined) { return (body ?? "").replaceAll("\\_", "_"); } +export function planPreviewLabel(revision: number): RegExp { + return new RegExp(`^Open Plan revision ${revision}(?: in task sidebar)?$`); +} + export async function expectPlanStageVisible(page: Page, options: { native: boolean; revision: number | null }) { const root = options.native ? page.locator('[data-testid="task-chat-turn"][data-settled="true"]') : page.locator("body"); const preview = root.getByTestId("task-chat-plan-preview").last(); await expect(preview).toBeVisible({ timeout: 30_000 }); - if (options.revision !== null) await expect(preview).toHaveAttribute("aria-label", `Open Plan revision ${options.revision}`); + if (options.revision !== null) await expect(preview).toHaveAttribute("aria-label", planPreviewLabel(options.revision)); } /** The classic matrix and deployment-targeted journeys share this exact user story. */ diff --git a/tests/runner-e2e/product-journeys/contracts.test.ts b/tests/runner-e2e/product-journeys/contracts.test.ts index a702406ee61..219fff80f32 100644 --- a/tests/runner-e2e/product-journeys/contracts.test.ts +++ b/tests/runner-e2e/product-journeys/contracts.test.ts @@ -17,7 +17,11 @@ import { journeyRequiredChecks } from "./success-contract.js"; import type { OnboardingConnectEvidence } from "./onboarding-connect.js"; vi.mock("@playwright/test", () => ({ expect: Object.assign( - (locator: { textContent(): Promise }) => ({ async toContainText(value: string) { expect(await locator.textContent()).toContain(value); } }), + (locator: { textContent(): Promise; isVisible?(): Promise }) => ({ + async toContainText(value: string) { expect(await locator.textContent()).toContain(value); }, + async toBeVisible() { expect(await locator.isVisible?.()).toBe(true); }, + async toBeInViewport() {}, + }), { poll: (read: () => Promise) => ({ async toBe(value: unknown) { expect(await read()).toBe(value); } }) }, ), })); @@ -189,10 +193,23 @@ describe("deployment journey contracts", () => { await fixtures.resolve(["backlog-task"]); api.post.mockImplementation(async () => { throw Error("task creation inside measured story"); }); let assigned = false; - const locator = { filter: vi.fn(), first: vi.fn(), locator: vi.fn(), getByRole: vi.fn(), click: vi.fn(), isVisible: vi.fn(async () => false), textContent: vi.fn(async () => assigned ? "You" : "Unassigned") }; - for (const method of [locator.filter, locator.first, locator.locator, locator.getByRole]) method.mockReturnValue(locator); + let panelOpen = false; + let propertiesSelected = false; + const chain = (target: T) => Object.assign(target, { filter: vi.fn(() => target), first: vi.fn(() => target) }); + const hidden = chain({ isVisible: vi.fn(async () => false), click: vi.fn() }); + const link = chain({ click: vi.fn() }); + const opener = chain({ isVisible: vi.fn(async () => !panelOpen), click: vi.fn(async () => { panelOpen = true; }) }); + const propertiesOption = chain({ isVisible: vi.fn(async () => panelOpen && !propertiesSelected), click: vi.fn(async () => { propertiesSelected = true; }) }); + const valueButton = chain({ click: vi.fn() }); + const value = chain({ getByRole: vi.fn(() => valueButton), textContent: vi.fn(async () => assigned ? "You" : "Unassigned") }); + const assignee = chain({ isVisible: vi.fn(async () => propertiesSelected), locator: vi.fn(() => value), + scrollIntoViewIfNeeded: vi.fn() }); + const locator = link; const assign = { click: vi.fn(async () => { assigned = true; }) }; - const page = { goto: vi.fn(), reload: vi.fn(), locator: vi.fn(() => locator), getByRole: vi.fn((_role: string, options?: { name?: unknown }) => options?.name === "Assign to me" ? assign : locator) }; + const page = { goto: vi.fn(), reload: vi.fn(async () => { panelOpen = false; propertiesSelected = false; }), locator: vi.fn(() => assignee), + getByRole: vi.fn((role: string, options?: { name?: unknown }) => options?.name === "Assign to me" ? assign + : role === "link" ? link : role === "option" ? propertiesOption : role === "tab" ? hidden + : options?.name === "Open a new tab" || options?.name === "Toggle side panel" ? hidden : opener) }; const get = vi.fn(async (route: string) => route.endsWith("/runs") ? [] : { assigneeUserId: assigned ? context.user.id : null, assigneeAgentId: null, status: "backlog" }); Object.assign(context.api, { get }); context.page = page as unknown as JourneyContext["page"]; @@ -202,6 +219,8 @@ describe("deployment journey contracts", () => { expect(session.own).toHaveBeenCalledTimes(2); expect(page.goto).toHaveBeenCalledExactlyOnceWith("https://qa.example.test/QA/issues"); expect(locator.filter).toHaveBeenCalledWith({ hasText: "Journey QA campaign-1" }); + expect(opener.click).toHaveBeenCalledTimes(2); + expect(propertiesOption.click).toHaveBeenCalledTimes(2); expect(assign.click).toHaveBeenCalledOnce(); expect(page.reload).toHaveBeenCalledOnce(); expect(get.mock.calls.map(([route]) => route)).toEqual(["/api/issues/task-1", "/api/issues/task-1", "/api/issues/task-1/runs"]); diff --git a/tests/runner-e2e/product-journeys/inbox-triage-flow.ts b/tests/runner-e2e/product-journeys/inbox-triage-flow.ts index baca8ab7ef8..c93acb94219 100644 --- a/tests/runner-e2e/product-journeys/inbox-triage-flow.ts +++ b/tests/runner-e2e/product-journeys/inbox-triage-flow.ts @@ -68,7 +68,15 @@ export async function inboxTriage(context: JourneyContext, session: TargetSessio await inboxStep("inbox_unread_projection_failed", () => expect.poll(async () => (await read()).isUnreadForMe).toBe(true)); await openPersonalInbox(context, "unread"); await inboxStep("inbox_unread_row_missing", () => expect(row).toBeVisible()); - await inboxStep("inbox_mark_read_failed", () => row.getByRole("button", { name: "Mark as read", exact: true }).click()); + await inboxStep("inbox_mark_read_failed", async () => { + const markRead = row.getByRole("button", { name: "Mark as read", exact: true }); + if (await markRead.isVisible()) return await markRead.click(); + await openPersonalInbox(context, "mine"); + await expect(row).toBeVisible(); + await page.getByPlaceholder(/^Search (?:inbox|tasks)(?:…|\.\.\.)$/i).blur(); + await row.hover(); + await page.keyboard.press("r"); + }); await inboxStep("inbox_read_projection_failed", () => expect.poll(async () => (await read()).isUnreadForMe).toBe(false)); await inboxStep("inbox_unread_reload_failed", () => page.reload()); await openPersonalInbox(context, "unread"); diff --git a/tests/runner-e2e/product-journeys/project-context-readback.ts b/tests/runner-e2e/product-journeys/project-context-readback.ts index 498e9c7a5f3..854dea3bdd8 100644 --- a/tests/runner-e2e/product-journeys/project-context-readback.ts +++ b/tests/runner-e2e/product-journeys/project-context-readback.ts @@ -1,4 +1,5 @@ import { expect, type Page } from "@playwright/test"; +import { showPropertyRow } from "./task-panel.js"; import { JourneyError } from "./types.js"; type BrowserStage = "project_list" | "project_open" | "project_task_open" | "project_property"; @@ -39,9 +40,7 @@ export async function openProjectTaskThroughList(input: { page: Page; origin: st await expect(main.getByText(prompt, { exact: true }).filter({ visible: true }).first()).toBeVisible(); }); await browserStep("project_property", async () => { - const properties = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).filter({ visible: true }).first(); - if (await properties.isVisible()) await properties.click(); - const projectProperty = page.locator("[data-property-row]").filter({ has: page.locator('[data-property-label="Project"]') }).filter({ visible: true }); + const projectProperty = await showPropertyRow(page, "Project"); await expect(projectProperty).toHaveCount(1); await expect(projectProperty.locator("[data-property-value]")).toContainText(projectName); }); diff --git a/tests/runner-e2e/product-journeys/task-dependency-resume.test.ts b/tests/runner-e2e/product-journeys/task-dependency-resume.test.ts index fa694af7d1d..b6a4397a988 100644 --- a/tests/runner-e2e/product-journeys/task-dependency-resume.test.ts +++ b/tests/runner-e2e/product-journeys/task-dependency-resume.test.ts @@ -59,6 +59,7 @@ async function fixture(premature = false, options: FixtureOptions = {}) { if (key.includes("data-property-row")) return panelOpen && !options.missingProperty; if (key === "Toggle side panel") return !panelOpen && options.closedPanel === "toggle"; if (key.includes("Show properties")) return !panelOpen && options.closedPanel === "properties"; + if (key === "Open a new tab" || key === "/^Properties/") return false; return true; }, async scrollIntoViewIfNeeded() { actions.push(`scroll:${key}`); }, diff --git a/tests/runner-e2e/product-journeys/task-dependency-resume.ts b/tests/runner-e2e/product-journeys/task-dependency-resume.ts index ed13e309878..98bc71e6a88 100644 --- a/tests/runner-e2e/product-journeys/task-dependency-resume.ts +++ b/tests/runner-e2e/product-journeys/task-dependency-resume.ts @@ -1,4 +1,5 @@ import { randomBytes } from "node:crypto"; +import { showPropertyRow } from "./task-panel.js"; import { mkdir, writeFile } from "node:fs/promises"; import path from "node:path"; import { expect } from "@playwright/test"; @@ -29,20 +30,7 @@ const documentSnapshot = (row: Row) => Object.fromEntries(["id", "companyId", "i "documentId", "createdByAgentId", "createdByUserId", "createdByRunId"].map(key => [key, row[key]])); async function properties(context: JourneyContext, label: string) { - const { page } = context; - const row = page.locator('[data-property-row]:not([inert] *):not([aria-hidden="true"] *)') - .filter({ has: page.locator(`[data-property-label="${label}"]`) }).filter({ visible: true }); - const toggle = page.getByRole("button", { name: "Toggle side panel", exact: true, pressed: false }).filter({ visible: true }); - const propertiesButton = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).filter({ visible: true }); - await expect.poll(async () => await row.isVisible() || await toggle.isVisible() || await propertiesButton.isVisible()).toBe(true); - if (!await row.isVisible()) { - if (await toggle.isVisible()) await toggle.click(); - else await propertiesButton.click(); - } - await expect(row).toBeVisible(); - await row.scrollIntoViewIfNeeded(); - await expect(row).toBeInViewport(); - return row; + return await showPropertyRow(context.page, label); } async function setStatus(context: JourneyContext, label: string) { const { page } = context; diff --git a/tests/runner-e2e/product-journeys/task-document-flow.test.ts b/tests/runner-e2e/product-journeys/task-document-flow.test.ts index 21b546778ee..cd353db0565 100644 --- a/tests/runner-e2e/product-journeys/task-document-flow.test.ts +++ b/tests/runner-e2e/product-journeys/task-document-flow.test.ts @@ -25,7 +25,7 @@ describe("task document reopen navigation", () => { expect(hasText).toBe(issue.title); return { first: () => ({ click }) }; } } - : { isVisible: async () => true, first: () => ({ isVisible: async () => true }) }, + : (() => { const visible = { isVisible: async () => true, filter: () => visible, first: () => visible }; return visible; })(), }, } as unknown as JourneyContext; await reopenTaskDocument(context, issue); diff --git a/tests/runner-e2e/product-journeys/task-document-flow.ts b/tests/runner-e2e/product-journeys/task-document-flow.ts index 32dd89d69c5..b48c98d30a1 100644 --- a/tests/runner-e2e/product-journeys/task-document-flow.ts +++ b/tests/runner-e2e/product-journeys/task-document-flow.ts @@ -1,26 +1,10 @@ import { expect } from "@playwright/test"; +import { openTaskPanelTab } from "./task-panel.js"; import { taskDocumentHistoryPasses, taskDocumentMatches, type TaskDocumentExpectation, type TaskDocumentRevision, type TaskDocumentSnapshot } from "./task-document-evidence.js"; import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js"; export async function openDocumentAuthoring({ page }: JourneyContext) { - const create = page.getByRole("button", { name: "New document", exact: true }); - const properties = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).first(); - const artifacts = page.getByRole("tab", { name: /^Artifacts/ }).first(); - const addTab = page.getByRole("button", { name: "Open a new tab", exact: true }); - const panelReady = async () => await create.isVisible() || await artifacts.isVisible() || await addTab.isVisible(); - await expect.poll(async () => await properties.isVisible() || await panelReady()).toBe(true); - if (await create.isVisible()) return; - if (await properties.isVisible()) { - await properties.click(); - await expect.poll(panelReady).toBe(true); - if (await create.isVisible()) return; - } - if (await artifacts.isVisible()) await artifacts.click(); - else { - await addTab.click(); - await page.getByRole("option", { name: /^Artifacts/ }).click(); - } - await expect(create).toBeVisible(); + await openTaskPanelTab(page, "Artifacts", page.getByRole("button", { name: "New document", exact: true })); } export async function reopenTaskDocument(context: JourneyContext, issue: { title: string }) { diff --git a/tests/runner-e2e/product-journeys/task-lifecycle.ts b/tests/runner-e2e/product-journeys/task-lifecycle.ts index b2086f890cb..c25068b1555 100644 --- a/tests/runner-e2e/product-journeys/task-lifecycle.ts +++ b/tests/runner-e2e/product-journeys/task-lifecycle.ts @@ -3,6 +3,7 @@ import path from "node:path"; import { expect } from "@playwright/test"; import { createTaskThroughUi, withBrowserEvent } from "../user-actions.js"; import { createObservedReader } from "./observation-read.js"; +import { showPropertyRow } from "./task-panel.js"; import { taskLifecycleEvidence, taskLifecycleLabelName, type LifecycleExpectation, type LifecycleLabel, type LifecycleObservation, type LifecycleTask } from "./task-lifecycle-evidence.js"; import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js"; @@ -17,22 +18,7 @@ const emptyObservation = (): LifecycleObservation => ({ task: null, runCount: nu titleVisible: false, descriptionVisible: false, statusVisible: false, labelVisible: false }); async function properties(context: JourneyContext) { - const { page } = context; - // Closed panes keep their rows mounted. Their geometry alone does not make - // an inert or accessibility-hidden panel available for interaction. - const row = page.locator('[data-property-row]:not([inert] *):not([aria-hidden="true"] *)') - .filter({ has: page.locator('[data-property-label="Labels"]') }).filter({ visible: true }); - const toggle = page.getByRole("button", { name: "Toggle side panel", exact: true, pressed: false }).filter({ visible: true }); - const propertiesButton = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).filter({ visible: true }); - await expect.poll(async () => await row.isVisible() || await toggle.isVisible() || await propertiesButton.isVisible()).toBe(true); - if (!await row.isVisible()) { - if (await toggle.isVisible()) await toggle.click(); - else await propertiesButton.click(); - } - await expect(row).toBeVisible(); - await row.scrollIntoViewIfNeeded(); - await expect(row).toBeInViewport(); - return row; + return await showPropertyRow(context.page, "Labels"); } async function setStatus(context: JourneyContext, label: string) { diff --git a/tests/runner-e2e/product-journeys/task-panel.ts b/tests/runner-e2e/product-journeys/task-panel.ts new file mode 100644 index 00000000000..7285dc2d47a --- /dev/null +++ b/tests/runner-e2e/product-journeys/task-panel.ts @@ -0,0 +1,37 @@ +import { expect, type Locator, type Page } from "@playwright/test"; + +export function visiblePropertyRow(page: Page, label: string): Locator { + return page.locator('[data-property-row]:not([inert] *):not([aria-hidden="true"] *)') + .filter({ has: page.locator(`[data-property-label="${label}"]`) }).filter({ visible: true }); +} + +export async function openTaskPanelTab(page: Page, tabName: "Properties" | "Artifacts", ready: Locator): Promise { + const name = new RegExp(`^${tabName}`); + const tab = page.getByRole("tab", { name }).filter({ visible: true }).first(); + const option = page.getByRole("option", { name }).filter({ visible: true }).first(); + const newTab = page.getByRole("button", { name: "Open a new tab", exact: true }).filter({ visible: true }).first(); + const opener = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).filter({ visible: true }).first(); + const toggle = page.getByRole("button", { name: "Toggle side panel", exact: true, pressed: false }).filter({ visible: true }).first(); + const anyVisible = async (...locators: Locator[]) => { + for (const locator of locators) if (await locator.isVisible()) return true; + return false; + }; + for (let step = 0; step < 4; step++) { + await expect.poll(() => anyVisible(ready, tab, option, newTab, toggle, opener)).toBe(true); + if (await ready.isVisible()) return; + if (await option.isVisible()) await option.click(); + else if (await tab.isVisible()) await tab.click(); + else if (await newTab.isVisible()) await newTab.click(); + else if (await toggle.isVisible()) await toggle.click(); + else await opener.click(); + } + await expect(ready).toBeVisible(); +} + +export async function showPropertyRow(page: Page, label: string): Promise { + const row = visiblePropertyRow(page, label); + await openTaskPanelTab(page, "Properties", row); + await row.scrollIntoViewIfNeeded(); + await expect(row).toBeInViewport(); + return row; +} diff --git a/tests/runner-e2e/product-journeys/task-properties.ts b/tests/runner-e2e/product-journeys/task-properties.ts index ca836af1c8b..be0d0a513c6 100644 --- a/tests/runner-e2e/product-journeys/task-properties.ts +++ b/tests/runner-e2e/product-journeys/task-properties.ts @@ -1,4 +1,5 @@ import { expect } from "@playwright/test"; +import { showPropertyRow, visiblePropertyRow } from "./task-panel.js"; import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js"; export async function taskProperties(context: JourneyContext, _session: TargetSession, _campaignId: string, evidence: JourneyEvidence) { @@ -11,13 +12,14 @@ export async function taskProperties(context: JourneyContext, _session: TargetSe // The declared starting point is the task list. Navigation to the task is a user action. await page.goto(`${api.origin}/${company.issuePrefix}/issues`); await page.getByRole("link").filter({ hasText: issue.title }).first().click(); - const properties = page.getByRole("button", { name: /^(Show properties|Properties)$/ }).first(); - if (await properties.isVisible()) await properties.click(); - const assignee = page.locator("[data-property-row]").filter({ has: page.locator('[data-property-label="Assignee"]') }); + const assignee = visiblePropertyRow(page, "Assignee"); + const showAssignee = () => showPropertyRow(page, "Assignee"); + await showAssignee(); await assignee.locator("[data-property-value]").getByRole("button").first().click(); await page.getByRole("button", { name: "Assign to me", exact: true }).click(); await expect.poll(async () => (await api.get<{ assigneeUserId: string }>(`/api/issues/${issue.id}`)).assigneeUserId).toBe(user.id); await page.reload(); + await showAssignee(); await expect(assignee.locator("[data-property-value]")).toContainText("You"); const persisted = await api.get<{ assigneeUserId: string; assigneeAgentId: string | null; status: string }>(`/api/issues/${issue.id}`); if (persisted.assigneeUserId !== user.id || persisted.assigneeAgentId !== null || persisted.status !== "backlog") throw new JourneyError("failed", "assignment_persistence_mismatch");