test(app): update e2e for ungrouped subagent rows

This commit is contained in:
Dax Raad
2026-10-18 23:41:29 -04:00
Unverified
parent 500b148c7e
commit 2ce42cac3d
2 changed files with 14 additions and 22 deletions
@@ -59,12 +59,11 @@ test("keeps the parent title anchored when opening a subagent", async ({ page })
// The title first renders in the loading header, which the timeline replaces once messages arrive.
// Measuring before then can read the detached heading, whose empty bounds put the start at 0.
const agents = page.getByRole("button", { name: "Used 1 Agent", exact: true })
await expect(agents).toBeVisible()
const card = page.locator(`a[href="${sessionHref(childID)}"]`)
await expect(card).toBeVisible()
const start = await titleInlineStart(page.locator("[data-session-title]").getByRole("heading", { name: parentTitle }))
await agents.click()
await page.locator(`a[href="${sessionHref(childID)}"]`).click()
await card.click()
await expectSessionTitle(page, taskDescription)
const breadcrumb = page.locator('[data-slot="session-title-parent"]')
@@ -185,7 +184,6 @@ test("shows parent lineage while the child timeline loads", async ({ page }) =>
await page.goto(sessionHref(parentID))
await expectSessionTitle(page, parentTitle)
await page.getByRole("button", { name: "Used 1 Agent", exact: true }).click()
await page.locator(`a[href="${sessionHref(childID)}"]`).click()
await Promise.all([requested.promise, expect(page).toHaveURL(sessionHref(childID))])
await Promise.all([
@@ -210,7 +208,6 @@ test("keeps the parent visible while the child session resolves", async ({ page
await page.goto(sessionHref(parentID))
await expectSessionTitle(page, parentTitle)
await page.getByRole("button", { name: "Used 1 Agent", exact: true }).click()
await page.locator(`a[href="${sessionHref(childID)}"]`).click()
await requested.promise
await Promise.all([expect(page).toHaveURL(sessionHref(parentID)), expectSessionTitle(page, parentTitle)]).finally(
@@ -374,7 +371,6 @@ function titleInlineStart(title: Locator) {
async function openChildFromParent(page: Page) {
await page.goto(sessionHref(parentID))
await expectSessionTitle(page, parentTitle)
await page.getByRole("button", { name: "Used 1 Agent", exact: true }).click()
const card = page.locator(`a[href="${sessionHref(childID)}"]`)
await expect(card).toBeVisible()
@@ -804,7 +804,7 @@ test.describe("background shortcut", () => {
await expectBackgroundRequest(page)
})
for (const name of ["read", "shell", "subagent"] as const) {
for (const name of ["read", "shell"] as const) {
test(`keeps Working and the shortcut for a grouped running ${name}`, async ({ page }) => {
await setupTimeline(page, {
viewport: { width: name === "shell" ? 390 : 1400, height: 900 },
@@ -818,11 +818,7 @@ test.describe("background shortcut", () => {
"prt_grouped_active",
name,
"running",
{
read: { filePath: "src/working.ts" },
shell: { command: "sleep 10" },
subagent: { agent: "general", description: "Inspect the timeline", prompt: "Inspect it." },
}[name],
{ read: { filePath: "src/working.ts" }, shell: { command: "sleep 10" } }[name],
),
],
{ completed: false },
@@ -835,24 +831,20 @@ test.describe("background shortcut", () => {
await expect(trigger).toHaveAttribute("aria-expanded", "false")
await expect(working).toBeInViewport()
if (name !== "read") {
if (name === "shell") {
await expect(backgroundHint(page)).toBeInViewport()
await expect(page.locator('[data-component="session-background-hint-row"]')).toHaveCSS("height", "24px")
}
await trigger.click()
await expect(trigger).toHaveAttribute("aria-expanded", "true")
if (name === "subagent") await expect(group.getByText("Inspect the timeline", { exact: true })).toBeVisible()
if (name !== "subagent")
await expect(group.locator('[data-component="text-shimmer"][data-active="true"]')).toBeVisible()
await expect(group.locator('[data-component="text-shimmer"][data-active="true"]')).toBeVisible()
await expect(working).toBeVisible()
await trigger.click()
await expect(trigger).toHaveAttribute("aria-expanded", "false")
await expect(working).toBeVisible()
if (name !== "read") await expectBackgroundRequest(page)
if (name === "shell") await expectBackgroundRequest(page)
})
}
@@ -949,13 +941,17 @@ test.describe("background shortcut", () => {
},
})
const backgroundCard = page.locator('[data-timeline-part-id="call_backgrounded"]')
const blockingCard = page.locator('[data-timeline-part-id="call_blocking"]')
await expect(backgroundHint(page)).toBeVisible()
await expect(backgroundCard).toContainText("Background task (background)")
await expect(blockingCard).toContainText("Foreground task")
await expect(blockingCard).not.toContainText("(background)")
const used = page
.locator('[data-timeline-part-ids="call_backgrounded,call_shell_backgrounded,call_blocking"]')
.locator('[data-timeline-part-ids="call_shell_backgrounded"]')
.locator(':scope > [data-component="collapsible"] > [data-slot="collapsible-trigger"]')
await expect(used).toHaveText(/^Used\s*3\s*Agent, Shell$/)
await expect(used).toHaveText(/^Used\s*1\s*Shell$/)
await expect(used).toHaveAttribute("aria-expanded", "false")
const activity = page.getByRole("button", { name: "2 subagents · 1 shell", exact: true })
const list = page.getByRole("menu", { name: "2 subagents · 1 shell", exact: true })