Files
PaperClipAI/tests/e2e/application-delete-screenshot.spec.ts
T
DottaandPaperclip c90d904779 feat(apps): add connection intent setup experience (#12347)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The backend now turns agent requests into durable connection
intents.
> - Operators need a clear path to inspect, configure, and finish those
requests.
> - The experience must preserve identity, agent access, and interrupted
setup state.
> - This pull request adds the connection intent setup experience across
the app UI.
> - The benefit is one guided flow from agent request to governed
connection.

## Linked Issues or Issue Description

Refs #11965

This is stack 9 of 11. It depends on stack 8 and replaces another
reviewable part of #11965.

## What Changed

- Add connection intent cards and setup flow integration.
- Add browse, connection, app detail, and sidebar experience updates.
- Preserve exact draft identity and access choices across resume and
OAuth recovery.
- Add focused UI, architecture, policy, and end-to-end coverage.
- Keep transient retained-connection lookup failures retryable instead
of misclassifying them as missing targets.
- Align the dark-mode E2E contract with the intentionally hidden
Gateways and Profiles sidebar tabs.

## Verification

- `pnpm -r typecheck`
- Focused UI result: 372 tests passed across 20 files.
- AppsConnect regression suite: 80/80 passed, including failed
connection and application lookups during retained reconnect.
- `pnpm --filter @paperclipai/ui exec vitest run
src/components/AppsSidebar.test.tsx` (1 passed)
- `pnpm check:token-gates`
- `pnpm --filter @paperclipai/db check:migrations`
- `pnpm build`

## Risks

- An interrupted OAuth flow can leave a durable draft that needs resume.
- The UI resumes the exact draft and keeps its identity and agent access
settings.
- Retained reconnect retries refetch connections and applications
together to avoid mixing partial snapshots.
- Gateways and Profiles remain route-accessible but intentionally absent
from the sidebar until their existing ship gate is lifted.
- The change does not add a database migration.

> I checked `ROADMAP.md`. This stack continues the existing app
connection work from #11965 and does not duplicate another planned item.

## Model Used

OpenAI Codex, GPT-5. The runtime model ID and context window were not
exposed. The model used reasoning, 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 linked the public source pull request with `Refs #`
- [x] I have not referenced internal or instance-local Paperclip issues
or links
- [x] My branch name describes the change 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: Paperclip <noreply@paperclip.ing>
2026-08-29 12:08:35 -05:00

51 lines
2.7 KiB
TypeScript

import { expect, test } from "@playwright/test";
// One-off visual capture for PAP-10817. The retired Tools -> Applications
// table now redirects into Apps, so capture the current app removal
// confirmation on the app Advanced tab instead.
test("captures the current app removal confirmations", async ({ page }) => {
const flags = await page.request.patch("/api/instance/settings/experimental", { data: { enableApps: true } });
expect(flags.ok(), `enable apps failed ${flags.status()}: ${await flags.text()}`).toBe(true);
const companyRes = await page.request.post("/api/companies", {
data: { name: `PAP-10817 remove app ${Date.now()}` },
});
expect(companyRes.ok(), `create company failed ${companyRes.status()}: ${await companyRes.text()}`).toBe(true);
const company = await companyRes.json();
const companyId: string = company.id;
const prefix: string = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E";
const created = await page.request.post(`/api/companies/${companyId}/tools/applications`, {
data: { name: "Demo Notes", description: "Sample MCP application", type: "mcp_http" },
});
expect(created.ok(), `create failed ${created.status()}: ${await created.text()}`).toBe(true);
const application = await created.json();
await page.goto(`/${prefix}/apps/app/${application.id}/advanced`);
await expect(page.getByRole("heading", { name: "Demo Notes" })).toBeVisible({ timeout: 15_000 });
await page.getByRole("button", { name: "Danger zone" }).click();
await page.getByRole("button", { name: "Remove app", exact: true }).click();
await expect(page.getByRole("button", { name: "Yes, remove it" })).toBeVisible();
await page.screenshot({ path: "test-results/pap-10817-delete-dialog.png", fullPage: true });
const conn = await page.request.post(`/api/companies/${companyId}/tools/connections`, {
data: {
applicationName: "Guarded MCP",
name: "Primary connection",
transport: "mcp_remote",
config: { url: "http://127.0.0.1:65535/mcp" },
},
});
expect(conn.ok(), `connection create failed ${conn.status()}: ${await conn.text()}`).toBe(true);
const connection = await conn.json();
await page.goto(`/${prefix}/apps/${connection.id}/advanced`);
await expect(page.getByRole("heading", { name: "Primary connection" })).toBeVisible({ timeout: 15_000 });
await page.getByRole("button", { name: "Danger zone" }).click();
await page.getByRole("button", { name: "Remove app", exact: true }).click();
await expect(page.getByRole("button", { name: "Yes, remove it" })).toBeVisible();
await page.screenshot({ path: "test-results/pap-10817-delete-dialog-guarded.png", fullPage: true });
await page.request.delete(`/api/companies/${companyId}`).catch(() => undefined);
});