Files
PaperClipAI/tests/e2e/plugins-browse.spec.ts
T
scotttongandScott Tong 8379dedd93 Pin Plugins by default in workspace navigation (#23578)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - People browse available integrations on the Plugins page.
> - A fresh Coordinator sidebar puts that page inside More.
> - People who look in Settings can miss it.
> - This pull request pins Plugins until a person chooses their own
layout.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

Finding the Plugins catalog on a first visit to the Coordinator
workspace.

**Current behavior**

Open a workspace in a fresh browser profile. The sidebar shows Inbox
followed by More. Open More to find Plugins.

**Proposed behavior**

Show Plugins below Inbox on the first visit. Honor saved pins and their
order, including an empty list.

Related discussion about navigation for individual plugin pages: #21807.

## What Changed

- Use the Plugins route as the default when the signed-in user has no
saved pin list in this browser.
- Add a browser regression for unpinning and re-pinning across reloads.
Update the AgentMail browser journey to use the visible Plugins link.
- Document the default and how to change it.

## Verification

- `pnpm exec vitest run ui/src/hooks/usePinnedNavigation.test.tsx`
passed.
- `pnpm exec playwright test -c tests/e2e/playwright.config.ts
tests/e2e/plugins-browse.spec.ts tests/e2e/agentmail.spec.ts` passed all
four Chromium tests against the built app and a disposable database.
- Compared the parent and feature commits in fresh Chromium sessions.
Confirmed the pin control in More and the unpin and reorder controls on
the pinned row.

## Risks

An existing user who has never saved pins in this browser also receives
the new default. A saved empty list keeps the sidebar empty of pins.

## Model Used

OpenAI GPT-6 (Codex), with repository editing and Chromium test
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
- [x] All Paperclip CI gates are green
- [x] 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: Scott Tong <scott@scotts-mbp-m5-max.local>
2026-12-02 18:30:20 -08:00

85 lines
4.6 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("Plugins is pinned on first visit and remembers unpinning and re-pinning", async ({ page, request }) => {
const response = await request.post("/api/companies", { data: { name: `plugin pins ${Date.now()}` } });
expect(response.ok()).toBe(true);
const company = await response.json();
const navigation = page.getByRole("navigation", { name: "Workspace navigation" });
const plugins = navigation.getByRole("link", { name: "Plugins", exact: true });
try {
await page.goto(`/${company.issuePrefix}/issues`);
await expect(plugins).toBeVisible();
await expect(plugins).toHaveAttribute("href", `/${company.issuePrefix}/apps`);
await plugins.hover();
await navigation.getByRole("button", { name: "Unpin Plugins" }).click();
await expect(plugins).toHaveCount(0);
await page.reload();
await navigation.getByRole("button", { name: "More workspace pages" }).click();
const pin = page.getByRole("button", { name: "Pin Plugins", exact: true });
await expect(pin).toBeEnabled();
await expect(plugins).toHaveCount(0);
await pin.click();
await page.reload();
await expect(plugins).toBeVisible();
} finally {
await request.delete(`/api/companies/${company.id}`);
}
});
test("browse shows capped category blocks that open a full category page", async ({ page, request }) => {
const res = await request.post("/api/companies", { data: { name: `plugins browse ${Date.now()}` } });
expect(res.ok(), `create company failed ${res.status()}: ${await res.text()}`).toBe(true);
const company = await res.json();
const prefix = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E";
try {
await page.goto(`/${prefix}/apps`);
await expect(page.getByRole("radio", { name: "All", exact: true })).toBeChecked({ timeout: 30_000 });
await expect(page.getByRole("radio", { name: "Paperclip", exact: true })).toHaveCount(0);
await expect(page.getByRole("region", { name: "Most used" })).toBeVisible();
// A category block holds at most nine plugins, states its full size and links to the rest.
const block = page.getByRole("region", { name: /^Developer tools \([\d,]+\)$/ });
await expect(block).toBeVisible();
await expect(block.getByRole("listitem")).toHaveCount(9);
const total = Number((await block.getByRole("heading", { level: 2 }).textContent())?.match(/\(([\d,]+)\)/)?.[1].replace(/,/g, ""));
expect(total).toBeGreaterThan(9);
await block.getByRole("button", { name: "See all Developer tools" }).click();
await expect(page).toHaveURL(new RegExp(`/${prefix}/apps/category/developer$`));
await expect(page.getByText(`Developer tools (${total.toLocaleString("en-US")})`)).toBeVisible();
await expect(page.getByRole("list", { name: "Connector list" }).getByRole("listitem").nth(9)).toBeVisible();
await expect(page.getByRole("radio", { name: "All", exact: true })).toHaveCount(0);
// The Categories list has no counts and opens the same pages.
await page.getByRole("button", { name: "Plugins", exact: true }).click();
const categories = page.getByRole("navigation", { name: "Categories" });
await expect(categories.getByRole("button", { name: "Commerce", exact: true })).toBeVisible();
await categories.getByRole("button", { name: "Commerce", exact: true }).click();
await expect(page).toHaveURL(new RegExp(`/${prefix}/apps/category/commerce$`));
} finally {
await request.delete(`/api/companies/${company.id}`).catch(() => undefined);
}
});
test("search matches plugin titles, not their descriptions", async ({ page, request }) => {
const res = await request.post("/api/companies", { data: { name: `plugins search ${Date.now()}` } });
expect(res.ok(), `create company failed ${res.status()}: ${await res.text()}`).toBe(true);
const company = await res.json();
const prefix = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E";
try {
await page.goto(`/${prefix}/apps`);
const search = page.getByRole("searchbox", { name: "Search plugins" });
const tiles = page.getByRole("list", { name: "Connector list" }).getByRole("listitem");
await search.fill("GitHub");
await expect(tiles.filter({ has: page.getByRole("heading", { name: "GitHub", exact: true }) })).toBeVisible({ timeout: 30_000 });
// "repositories" appears only in GitHub's description, so it no longer finds GitHub.
await search.fill("repositories");
await expect(tiles.filter({ has: page.getByRole("heading", { name: "GitHub", exact: true }) })).toHaveCount(0);
} finally {
await request.delete(`/api/companies/${company.id}`).catch(() => undefined);
}
});