Files
PaperClipAI/tests/e2e/coordinator-inbox-views.spec.ts
T
TonioandPaperclip d1207c31d4 Left-align wrapped Inbox filters with search (#22720)
## Thinking Path

> - Paperclip helps people manage agents and tasks.
> - The Inbox toolbar lets people search and filter decisions.
> - Its dropdowns wrap when the sidebar leaves too little room.
> - An automatic margin pushes the wrapped row away from Search.
> - This change distributes space between controls on the same row and
aligns wrapped controls with Search.

## Linked Issues or Issue Description

Refs #22675.

**What happened?**

At intermediate widths, Inbox filters wrapped onto a second row and left
a large blank space at its start.

**Expected behavior**

The first wrapped button lines up with Search.

**Steps to reproduce**

Open Inbox and narrow the content area until the filters wrap below
Search.

## What Changed

Use flexbox space distribution on the Inbox toolbar and clear the filter
group's automatic start margin.

## Verification

All 38 CoordinatorNeedsYou tests passed at 536c7385ce. Local browser
measurements during development confirmed aligned left edges at 320px
and 890px and a right-aligned filter group at 1200px.

## Risks

The layout depends on Search and the filter group being the toolbar's
two direct children.

## Model Used

OpenAI Codex (GPT-6), with code execution and browser verification.

## 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
- [ ] 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

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-23 17:05:27 -08:00

108 lines
6.6 KiB
TypeScript

import path from "node:path";
import { expect, test, type APIResponse } from "@playwright/test";
async function json(response: APIResponse) {
expect(response.ok(), `${response.status()} ${await response.text()}`).toBe(true);
return response.json();
}
test.use({ hasTouch: true });
for (const mobile of [false, true]) test(`Mine retains Inbox behavior inside Tasks (${mobile ? "mobile" : "desktop"})`, async ({ page, request }) => {
test.setTimeout(90_000);
await page.setViewportSize(mobile ? { width: 390, height: 844 } : { width: 1280, height: 900 });
await page.addInitScript(() => {
if (!localStorage.getItem("paperclip:inbox:issue-columns")) localStorage.setItem("paperclip:inbox:issue-columns", JSON.stringify(["status", "id", "project", "updated"]));
});
const company = await json(await request.post("/api/companies", { data: { name: "Personal Tasks verification" } }));
const preferences = await json(await request.get("/api/workspace-preferences/me"));
const preferencePath = `/api/companies/${company.id}/workspace-preferences/me`;
try {
await json(await request.put(preferencePath, { data: { coordinatorWorkspaceEnabled: true } }));
const agent = await json(await request.post(`/api/companies/${company.id}/agents`, { data: {
name: "Inbox activity fixture", adapterType: "process", adapterConfig: {
command: process.execPath, args: [path.resolve("tests/e2e/fixtures/inbox-activity.mjs")],
}, runtimeConfig: { heartbeat: { enabled: false, wakeOnDemand: true } },
} }));
const unread = await json(await request.post(`/api/companies/${company.id}/issues`, { data: {
title: "Unread personal task", status: "todo", assigneeAgentId: agent.id,
} }));
const read = await json(await request.post(`/api/companies/${company.id}/issues`, { data: { title: "Read personal task", status: "todo" } }));
await expect.poll(async () => {
const comments = await json(await request.get(`/api/issues/${unread.id}/comments`));
return comments.some((comment: { authorAgentId: string | null }) => comment.authorAgentId === agent.id);
}, { timeout: 30_000 }).toBe(true);
await json(await request.delete(`/api/issues/${unread.id}/read`));
await json(await request.post(`/api/issues/${read.id}/read`, { data: {} }));
await page.goto(`/${company.issuePrefix}/inbox/mine`);
await expect(page).toHaveURL(/\/issues\?view=mine$/);
const mine = page.getByRole("region", { name: "Tasks", exact: true });
const unreadRow = mine.locator(`[data-issue-id="${unread.id}"]`);
const readRow = mine.locator(`[data-issue-id="${read.id}"]`);
await expect(unreadRow).toHaveAttribute("data-unread", "true");
await expect(unreadRow.locator('[data-slot="task-row-title"]')).toHaveClass(/font-semibold/);
await expect(readRow.locator('[data-slot="task-row-title"]')).not.toHaveClass(/font-semibold/);
await expect(page.getByRole("link", { name: /^Inbox(?:,|$)/ }).first()).toHaveAttribute("href", `/${company.issuePrefix}/decisions`);
await page.getByRole("button", { name: "Columns", exact: true }).click();
const creatorColumn = page.getByRole("menuitemcheckbox", { name: /^Kicked off by/ });
await creatorColumn.click();
await expect(creatorColumn).toBeChecked();
await page.keyboard.press("Escape");
await page.locator('button[title="Group"]').click();
await page.getByRole("button", { name: "Project", exact: true }).click();
await page.keyboard.press("Escape");
await page.reload();
await expect(unreadRow).toBeVisible();
await expect(mine.getByText("No project", { exact: true }).first()).toBeVisible();
await page.getByRole("button", { name: "Columns", exact: true }).click();
await expect(creatorColumn).toBeChecked();
await page.keyboard.press("Escape");
await page.locator('button[title="Group"]').click();
await page.getByRole("button", { name: "None", exact: true }).click();
await page.keyboard.press("Escape");
if (mobile) {
await unreadRow.scrollIntoViewIfNeeded();
const bounds = await unreadRow.boundingBox();
expect(bounds).not.toBeNull();
const session = await page.context().newCDPSession(page);
const x = bounds!.x + bounds!.width * 0.85;
const y = bounds!.y + bounds!.height / 2;
await session.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x, y }] });
for (let step = 1; step <= 6; step++) await session.send("Input.dispatchTouchEvent", {
type: "touchMove", touchPoints: [{ x: x - bounds!.width * 0.1 * step, y }],
});
await session.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
await session.detach();
await expect(unreadRow).toHaveCount(0);
} else {
await unreadRow.hover();
await page.keyboard.press("r");
await expect(unreadRow).not.toHaveAttribute("data-unread", "true");
await page.keyboard.press("U");
await expect(unreadRow).toHaveAttribute("data-unread", "true");
const archiveSaved = page.waitForResponse(response => response.url().endsWith(`/api/issues/${unread.id}/inbox-archive`) && response.request().method() === "POST");
const archiveRefreshed = page.waitForResponse(response => response.url().includes(`/api/companies/${company.id}/inbox/mine`) && response.request().method() === "GET");
await page.keyboard.press("a");
expect((await archiveSaved).ok()).toBe(true);
await archiveRefreshed;
await page.evaluate(() => new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))));
await expect(unreadRow).toHaveCount(0);
await page.keyboard.press("u");
await expect(unreadRow).toBeVisible();
await page.getByRole("link", { name: "Inbox", exact: true }).click();
const inbox = page.getByRole("region", { name: "Needs You", exact: true });
await expect(inbox.getByRole("toolbar", { name: "Decisions controls" })).toBeVisible();
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, Assigned to you", exact: true })).toBeVisible();
await page.setViewportSize({ width: 1024, height: 720 });
const search = await inbox.locator("[data-toolbar-search]").boundingBox();
const firstFilter = await inbox.getByRole("button", { name: /^Filter decisions by agent,/ }).boundingBox();
expect(firstFilter!.y).toBeGreaterThanOrEqual(search!.y + search!.height);
expect(firstFilter!.x).toBeCloseTo(search!.x, 0);
}
} finally {
await request.put(preferencePath, { data: { coordinatorWorkspaceEnabled: preferences.coordinatorWorkspaceEnabled } });
await request.patch(`/api/companies/${company.id}`, { data: { status: "archived" } });
}
});