diff --git a/tests/runner-e2e/plan-revision-flow.test.ts b/tests/runner-e2e/plan-revision-flow.test.ts index 39322920453..dabad3d46fb 100644 --- a/tests/runner-e2e/plan-revision-flow.test.ts +++ b/tests/runner-e2e/plan-revision-flow.test.ts @@ -1,6 +1,6 @@ import { expect, it, vi } from "vitest"; import type { Page } from "@playwright/test"; -import { planPreviewLabel, runPlanRevisionAcceptance } from "./plan-revision-flow.js"; +import { planPreviewLabel, planStageRootSelector, runPlanRevisionAcceptance } from "./plan-revision-flow.js"; const state = { currentIssue: { status: "in_progress" }, @@ -44,3 +44,8 @@ it("accepts the classic and Coordinator Plan preview names for the exact revisio expect(planPreviewLabel(2).test("Open Plan revision 1 in task sidebar")).toBe(false); expect(planPreviewLabel(1).test("Open Plan in task sidebar")).toBe(false); }); + +it("finds the native Plan chip in a settled turn or directly in the Coordinator chat thread", () => { + expect(planStageRootSelector(true).split(", ")).toEqual(['[data-testid="task-chat-turn"][data-settled="true"]', '[data-testid="task-chat-thread"]']); + expect(planStageRootSelector(false)).toBe("body"); +}); diff --git a/tests/runner-e2e/plan-revision-flow.ts b/tests/runner-e2e/plan-revision-flow.ts index 553926580bb..f8e0df77840 100644 --- a/tests/runner-e2e/plan-revision-flow.ts +++ b/tests/runner-e2e/plan-revision-flow.ts @@ -23,8 +23,12 @@ export function planPreviewLabel(revision: number): RegExp { return new RegExp(`^Open Plan revision ${revision}(?: in task sidebar)?$`); } +export function planStageRootSelector(native: boolean): string { + return native ? '[data-testid="task-chat-turn"][data-settled="true"], [data-testid="task-chat-thread"]' : "body"; +} + export async function expectPlanStageVisible(page: Page, options: { native: boolean; revision: number | null }) { - const root = options.native ? page.locator('[data-testid="task-chat-turn"][data-settled="true"]') : page.locator("body"); + const root = page.locator(planStageRootSelector(options.native)); const preview = root.getByTestId("task-chat-plan-preview").last(); await expect(preview).toBeVisible({ timeout: 30_000 }); if (options.revision !== null) await expect(preview).toHaveAttribute("aria-label", planPreviewLabel(options.revision));