test(evals): respect app review preview content

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-11-02 21:16:38 -06:00
1 parent 481722349e
commit e55b3b025f
2 files changed
+2 -3

No files matched your search

@@ -9,9 +9,9 @@ import { appReviewExternalCases } from "./external-app-review.js";
afterEach(()=>vi.restoreAllMocks());
function fixture(fault?:"wrong preview"|"missing takeover"|"wrong app"|"wrong action"){
let opened=false,declined=false;const events:string[]=[];
const action={connectionId:"connection",actionRequestId:"action",invocationId:"invocation",appDisplayName:"Synthetic Launch Notes",toolName:"launch_update",toolDisplayName:"Update launch page",risk:"write",rememberActionScope:"Same agent, action, connection and project",previewMarkdown:"The public launch is November 8, 2030."};
const action={connectionId:"connection",actionRequestId:"action",invocationId:"invocation",appDisplayName:"Synthetic Launch Notes",toolName:"launch_update",toolDisplayName:"Update launch page",risk:"write",rememberActionScope:"Same agent, action, connection and project",previewMarkdown:"The public launch is November 8, 2030.\n\nUpdate launch page"};
const card={id:"selected",kind:"request_confirmation",status:"pending",sourceRunId:"source-native",payload:{toolAction:action}};
const timeline={visible:()=>fault!=="wrong preview",text:"Update launch page",getByRole:(_role:string,opts:{name:string})=>({click:async()=>{
const timeline={visible:()=>fault!=="wrong preview",text:action.previewMarkdown.split(/\n\s*\n/)[0],getByRole:(_role:string,opts:{name:string})=>({click:async()=>{
if(opts.name!=="Review request")throw Error("Timeline preview has no decision controls");events.push("open exact review");opened=true;
}})};
const review={visible:()=>opened&&fault!=="missing takeover",text:fault==="wrong action"?"Read launch page":"Update launch page",getByRole:(role:string,opts:{name:string})=>role==="img"?{visible:()=>opened&&fault!=="wrong app"&&opts.name===action.appDisplayName}:{click:async()=>{
@@ -451,7 +451,6 @@ export const appReviewExternalCases = [
`[id=${JSON.stringify(`interaction-${card.id}`)}]`,
);
await expect(timeline).toBeVisible();
await expect(timeline).toContainText("Update launch page");
// The timeline is a preview. Open this exact pending request before
// using the production decision controls in the composer takeover.
await timeline.getByRole("button", { name: "Review request", exact: true }).click();