Files
PaperClipAI/tests/e2e/helpers/onboarding-ai-connection.ts
T
Devin FoleyandPaperclip 17901d74ba Fix onboarding account changes after returning from Review (#19557)
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>
2026-11-06 11:55:29 -08:00

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 } });
});
}