Files
PaperClipAI/tests/runner-e2e/product-journeys/inbox-triage-flow.ts
DottaandClaude Opus 5.5 92308f839d test(e2e): use the Coordinator task panel, inbox and plan controls in QA journeys (#21701)
## 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 <managed local 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 <noreply@anthropic.com>
2026-11-15 03:08:23 +00:00

117 lines
7.8 KiB
TypeScript

import { expect } from "@playwright/test";
import { inboxArchivePersisted, inboxTaskMatches, inboxTaskResurfaced, type InboxTaskEvidence } from "./inbox-triage-evidence.js";
import { inboxAuthorCommentMatches, type InboxAuthorComment } from "./inbox-author-contract.js";
import { inboxBlockedActivity } from "./inbox-triage-fixture.js";
import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js";
export async function inboxStep<T>(code: string, operation: () => Promise<T>): Promise<T> {
try { return await operation(); }
catch (error) {
if (error instanceof JourneyError) throw error;
// Browser errors may carry form values and URLs. Retain only the fixed
// operation code, including which independent read failed.
throw new JourneyError("failed", code);
}
}
export async function openPersonalInbox(context: Pick<JourneyContext, "page" | "api" | "company">, view: "mine" | "unread") {
const { page, api, company } = context;
await inboxStep(`inbox_${view}_view_unavailable`, async () => {
await page.goto(`${api.origin}/${company.issuePrefix}/inbox/${view}`, { waitUntil: "domcontentloaded" });
const search = page.getByPlaceholder(/^Search (?:inbox|tasks)(?:…|\.\.\.)$/i);
await expect(search).toBeVisible();
// Global search supplements the inbox with other results whose read and
// archive controls differ. Act on the real personal view, scoped by row ID.
await search.fill("");
await expect(search).toHaveValue("");
// An absent row is meaningful only after this actual view has loaded its
// list or the correct empty state; a skeleton cannot prove exclusion.
await expect(page.getByRole("status", { name: "Loading tasks", exact: true })).toHaveCount(0);
const empty = page.getByText(view === "mine" ? "Inbox zero." : "No new inbox items.", { exact: true });
await expect(page.locator("#main-content [data-inbox-item]").or(empty).first()).toBeVisible();
});
}
export async function inboxTriage(context: JourneyContext, session: TargetSession, campaignId: string, evidence: JourneyEvidence) {
const { api, page, company, user } = context;
const author = context.fixtures?.inboxAuthor;
if (!author?.userId || author.userId === user.id) throw new JourneyError("unsupported", "inbox_human_author_required");
const title = `Journey QA inbox triage ${campaignId}`;
await session.own({ kind: "issue", name: title, journeyId: "inbox-triage" });
const issue = await inboxStep("inbox_task_creation_failed", () => api.post<InboxTaskEvidence & { title: string; identifier: string }>(`/api/companies/${company.id}/issues`, {
title, description: "Disposable personal inbox triage task.", assigneeUserId: user.id, assigneeAgentId: null, status: "in_progress",
}));
await session.own({ kind: "issue", name: title, id: issue.id, journeyId: "inbox-triage" });
const route = `/api/issues/${issue.id}`, expected = { id: issue.id, companyId: company.id, userId: user.id, status: "in_progress" };
const check = (id: string, passed: boolean) => {
evidence.checks.push({ id, passed });
if (!passed) throw new JourneyError("failed", id.replaceAll("-", "_"));
};
// Personal unread fields are available on the user-aware list projection.
const read = async () => {
const rows = await api.get<InboxTaskEvidence[]>(`/api/companies/${company.id}/issues?assigneeUserId=me&touchedByUserId=me&q=${encodeURIComponent(title)}`);
const own = rows.find(row => row.id === issue.id);
if (!own) throw new JourneyError("failed", "inbox_owned_task_projection_missing");
return own;
};
const mine = () => api.get<InboxTaskEvidence[]>(`/api/companies/${company.id}/issues?touchedByUserId=me&inboxArchivedByUserId=me`);
const row = page.locator(`[data-issue-row-details="${issue.id}"]`).first();
// Agent writes correctly require a real heartbeat run. The model-free inbox
// fixture uses a second normal human session rather than inventing a run.
const body = `Inbox fixture update ${campaignId}`;
const posted = await inboxStep("inbox_external_comment_failed", () => author.postComment({ issueId: issue.id, body }));
const saved = await inboxStep("inbox_external_comment_read_failed", () => api.get<InboxAuthorComment>(`${route}/comments/${posted.id}`));
const expectedAuthor = { companyId: company.id, issueId: issue.id, ownerUserId: user.id, authorUserId: author.userId, body };
check("inbox-external-human-activity", posted.id === saved.id
&& inboxAuthorCommentMatches(posted, expectedAuthor) && inboxAuthorCommentMatches(saved, expectedAuthor));
await inboxStep("inbox_mark_unread_failed", () => api.delete(`${route}/read`));
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", 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");
await inboxStep("inbox_read_row_still_visible", () => expect(row).toHaveCount(0));
check("inbox-read-persisted", inboxTaskMatches(await read(), expected) && (await read()).isUnreadForMe === false);
await openPersonalInbox(context, "mine");
await inboxStep("inbox_mine_row_missing", () => expect(row).toBeVisible());
await inboxStep("inbox_archive_control_failed", async () => {
await row.hover();
await row.getByRole("button", { name: "Archive", exact: true }).click();
});
await inboxStep("inbox_archive_projection_failed", () => expect.poll(async () => inboxArchivePersisted(await read(), expected, await mine())).toBe(true));
await inboxStep("inbox_mine_reload_failed", () => page.reload());
await openPersonalInbox(context, "mine");
await inboxStep("inbox_archived_row_still_visible", () => expect(row).toHaveCount(0));
check("inbox-archive-persisted", inboxArchivePersisted(await read(), expected, await mine()));
check("inbox-archive-preserved-task-status", (await read()).status === "in_progress");
// A real new Blocked transition is relevant activity. The fixture supplies the
// event, while the production archive policy must independently resurface it.
await inboxStep("inbox_relevant_activity_failed", () => api.patch(route, inboxBlockedActivity(user.id)));
const blocked = { ...expected, status: "blocked" };
await inboxStep("inbox_resurface_projection_failed", () => expect.poll(async () => inboxTaskResurfaced(await read(), blocked, await mine())).toBe(true));
await openPersonalInbox(context, "mine");
await inboxStep("inbox_resurfaced_row_missing", () => expect(row).toBeVisible());
await inboxStep("inbox_resurfaced_reload_failed", () => page.reload());
await openPersonalInbox(context, "mine");
await inboxStep("inbox_resurfaced_row_lost", () => expect(row).toBeVisible());
check("inbox-relevant-activity-resurfaced", inboxTaskResurfaced(await read(), blocked, await mine()));
check("no-agent-work", (await api.get<unknown[]>(`${route}/runs`)).length === 0);
// Leave the owned task open for the launcher's authenticated task screenshot.
await inboxStep("inbox_task_reopen_failed", async () => {
await page.goto(`${api.origin}/${company.issuePrefix}/issues/${issue.identifier}`, { waitUntil: "domcontentloaded" });
await expect(page.getByRole("heading", { name: title, exact: true })).toBeVisible();
});
}