mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-12 14:19:00 +01:00
Save changed onboarding connections on the existing agent after validation. Select the chosen personal provider account and serialize default changes so an abandoned save cannot override a later choice after Back. Preserve runner, environment, and unrelated agent settings. Reject unsupported managed-account to legacy-secret switches with an actionable Connect error. Verified with 327 component tests, three backend credential-selection tests, nine affected browser tests, typecheck, build, token gates, all CI jobs, and Greptile 5/5 with no unresolved comments. Co-Authored-By: Paperclip <noreply@paperclip.ing>
20 lines
929 B
TypeScript
20 lines
929 B
TypeScript
import { randomUUID } from "node:crypto";
|
|
import { expect, type Page } from "@playwright/test";
|
|
|
|
/** First-task tests exercise the real wizard and hire/task APIs with an inert
|
|
* adapter. Simulate successful provider authentication without using host auth. */
|
|
export async function mockOnboardingLocalAiConnection(page: Page) {
|
|
const connectionId = randomUUID();
|
|
const grantId = randomUUID();
|
|
await page.route("**/ai-connections/local", async (route) => {
|
|
expect(route.request().method()).toBe("POST");
|
|
expect(route.request().postDataJSON()).toMatchObject({ method: "subscription", ownership: "personal" });
|
|
await route.fulfill({ json: { connectionId, grantId } });
|
|
});
|
|
await page.route("**/ai-connections/default", async (route) => {
|
|
expect(route.request().method()).toBe("PUT");
|
|
expect(route.request().postDataJSON()).toEqual({ grantId });
|
|
await route.fulfill({ json: { ok: true } });
|
|
});
|
|
}
|