mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 08:22:20 +02:00
test(runner-e2e): wait for rendered warm review screenshots
Wait for the exact turn reply and pending review card with enabled Continue work, In Review header and completed history loading before capturing intermediate warm screenshots. Reuse the existing turn deadline; preserve prior screenshots and result grades. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a6a5417cd9
commit
11bc74b68d
1 file changed
+22
@@ -1695,6 +1695,28 @@ for (const execution of executions) {
|
||||
`/${encodeURIComponent(issuePrefix)}/issues/${encodeURIComponent(issue.identifier ?? issue.id)}`,
|
||||
{ waitUntil: "domcontentloaded" },
|
||||
);
|
||||
// Navigation commits before React has loaded the task. Bind the
|
||||
// screenshot to this turn's visible reply and exact pending review,
|
||||
// rather than capturing a spinner after DOMContentLoaded.
|
||||
const reviewUiTimeout = () => {
|
||||
const remaining = turnDeadlineAt - Date.now();
|
||||
if (remaining <= 0) throw new Error(`Warm turn ${completedTurn} UI deadline elapsed`);
|
||||
return Math.min(30_000, remaining);
|
||||
};
|
||||
await expect(page.getByTestId("issue-detail-header").getByRole("button", {
|
||||
name: "Change status (current: In Review)", exact: true,
|
||||
})).toBeVisible({ timeout: reviewUiTimeout() });
|
||||
const turnReply = page.getByTestId("task-chat-thread")
|
||||
.getByTestId("task-chat-agent-bubble")
|
||||
.filter({ hasText: `PAPERCLIP_E2E_WARM_T${completedTurn}_${nonce}` }).last();
|
||||
await expect(turnReply).toBeVisible({ timeout: reviewUiTimeout() });
|
||||
const pendingReview = waitingState.interactions.find(isPendingWarmConfirmation)!;
|
||||
const reviewCard = page.locator(`[id=${JSON.stringify(`interaction-${pendingReview.id}`)}]`);
|
||||
await expect(reviewCard).toBeVisible({ timeout: reviewUiTimeout() });
|
||||
await expect(reviewCard.getByRole("button", { name: "Continue work", exact: true }))
|
||||
.toBeEnabled({ timeout: reviewUiTimeout() });
|
||||
await expect(page.getByTestId("task-chat-history-loading"))
|
||||
.toHaveCount(0, { timeout: reviewUiTimeout() });
|
||||
await captureScreenshot(
|
||||
`warm-turn-${completedTurn}`,
|
||||
`Warm ${execution.environment.id} turn ${completedTurn} awaiting review`,
|
||||
|
||||
Reference in new issue
Block a user