| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- import assert from "node:assert/strict";
- import { test } from "node:test";
- import { join } from "node:path";
- export function registerActivityHistoryCases({ getBrowser, getOrigin, artifacts }) {
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`unknown total preserves observed result states ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- for (const [mix, label, secondary] of [
- ["resultPending,cancelled", "Completed", null],
- ["cancelled", "Activity", "Stopped"],
- ["failed,resultPending,cancelled", "Failed", "1"],
- ]) {
- await page.goto(
- getOrigin() +
- `fixture?real=1&endedOnly=1&theme=${theme}&locale=en-US&completedTotal=unknown&resultMix=${mix}`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), label);
- const count = capsule.locator("[data-status-capsule-secondary]");
- if (secondary === null) assert.equal(await count.count(), 0);
- else assert.equal(await count.textContent(), secondary);
- }
- } finally {
- await page.close();
- }
- });
- test(`unknown completed count is not a preview total ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- await page.goto(
- getOrigin() +
- `fixture?real=1&endedOnly=1&theme=${theme}&locale=en-US&completedTotal=unknown`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Completed");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").count(), 0);
- await capsule.click();
- assert.ok((await page.locator("[data-activity-id]").count()) > 0);
- } finally {
- await page.close();
- }
- });
- test(`complete history count exceeds preview ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- for (const total of [9, 105, 114]) {
- await page.goto(
- getOrigin() +
- `fixture?real=1&endedOnly=1&theme=${theme}&locale=en-US&completedTotal=${total}`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Completed");
- assert.equal(
- await capsule.locator("[data-status-capsule-secondary]").innerText(),
- String(total),
- );
- // 总数大于预览;不靠扩充头像/明细来凑出总数。
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 1);
- }
- } finally {
- await page.close();
- }
- });
- test(`ended activity hides duplicate descriptions ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- for (const summary of [
- "Inspect files",
- " Inspect files ",
- " ",
- "Inspection complete",
- ]) {
- await page.goto(
- getOrigin() +
- `fixture?real=1&endedOnly=1&theme=${theme}&locale=en-US&agentSummary=${encodeURIComponent(summary)}`,
- );
- await page.locator('[data-status-capsule="activity"]').click();
- const row = page.locator('[data-activity-result="completed"]');
- const description = row.locator("span.line-clamp-2.text-ui-sm");
- assert.equal(await description.count(), summary === "Inspection complete" ? 1 : 0);
- assert.equal(await row.getByText("Inspect files", { exact: true }).count(), 1);
- assert.match(await row.innerText(), /Completed/);
- if (summary === "Inspection complete")
- assert.equal(await description.innerText(), summary);
- if (summary === "Inspect files")
- await page.screenshot({
- path: join(artifacts, `activity-description-${width}-${theme}.png`),
- });
- }
- } finally {
- await page.close();
- }
- });
- }
- }
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`completed actors survive parent stop and running avatars outrank waiting ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- const capsule = page.locator('[data-status-capsule="activity"]');
- for (const runStatus of ["stopped", "errored"]) {
- await page.goto(
- getOrigin() +
- `fixture?real=1&endedOnly=1&workflow=1&mixedActors=1&allActorsDone=1&actorParentEnd=1&runStatus=${runStatus}&theme=${theme}&locale=en-US`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Active");
- assert.equal(await capsule.locator('[data-agent-result-badge="completed"]').count(), 3);
- await page.getByTestId("settle-workflow").click();
- assert.equal(
- await capsule.locator("[data-capsule-label]").textContent(),
- runStatus === "stopped" ? "Activity" : "Failed",
- );
- assert.equal(
- await capsule.locator("[data-status-capsule-secondary]").textContent(),
- runStatus === "stopped" ? "Stopped" : "1",
- );
- assert.equal(
- await capsule
- .locator('[data-subagent-avatar] [data-agent-result-badge="completed"]')
- .count(),
- 3,
- );
- await page.screenshot({
- path: join(artifacts, `completed-actors-${runStatus}-${width}-${theme}.png`),
- });
- await page.getByTestId("dismiss-activity").click();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 0);
- }
- await page.goto(
- getOrigin() +
- `fixture?real=1&workflow=1&waitingActors=1&mixedAgents=1&theme=${theme}&locale=en-US`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 3);
- assert.equal(
- await capsule.locator('[data-subagent-avatar][data-face-state="scanning"]').count(),
- 1,
- );
- assert.equal(
- await capsule.locator('[data-subagent-avatar][data-face-state="waiting"]').count(),
- 2,
- );
- await page.screenshot({
- path: join(artifacts, `running-before-waiting-${width}-${theme}.png`),
- });
- } finally {
- await page.close();
- }
- });
- test(`capsule keeps running and completed avatars with configured identity ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- const capsule = page.locator('[data-status-capsule="activity"]');
- await page.goto(
- getOrigin() +
- `fixture?theme=${theme}&locale=en-US&real=1&endedOnly=1&mixedAgents=1&configuredColor=1`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 2);
- assert.equal(await capsule.locator('[data-agent-result-badge="completed"]').count(), 1);
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Active");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- assert.equal(
- await capsule.locator("[data-subagent-avatar]").last().getAttribute("data-face-state"),
- "scanning",
- );
- assert.equal(
- await capsule.locator("[data-subagent-avatar]").first().getAttribute("data-face-state"),
- "content",
- );
- const faceColor = () =>
- capsule
- .locator("[data-subagent-avatar]")
- .first()
- .evaluate((el) => getComputedStyle(el).getPropertyValue("--wf-face-body").trim());
- assert.equal(await faceColor(), "#3C82F6");
- assert.equal(
- await page
- .locator('[data-testid="message-agent"] [data-subagent-avatar]')
- .evaluate((el) => getComputedStyle(el).getPropertyValue("--wf-face-body").trim()),
- await faceColor(),
- );
- await capsule.click();
- const detail = page.locator(
- '[data-testid="v4-running-subagent-item"] [data-subagent-avatar]',
- );
- assert.equal(
- await detail.evaluate((el) =>
- getComputedStyle(el).getPropertyValue("--wf-face-body").trim(),
- ),
- await faceColor(),
- );
- await page.getByTestId("outside").click();
- await page.screenshot({
- path: join(artifacts, `activity-avatar-identity-${width}-${theme}.png`),
- });
- await page.goto(
- getOrigin() +
- `fixture?theme=${theme}&locale=en-US&real=1&endedOnly=1&mixedAgents=1&workflow=1&mixedActors=1&allActorsDone=1`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 3);
- assert.equal(
- await capsule.locator("[data-subagent-avatar]").last().getAttribute("data-face-state"),
- "scanning",
- );
- assert.equal(await capsule.locator('[data-agent-result-badge="completed"]').count(), 2);
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- for (const runningCount of [2, 3, 4]) {
- await page.goto(
- getOrigin() +
- `fixture?theme=${theme}&locale=en-US&real=1&endedOnly=1&mixedAgents=1&runningCount=${runningCount}`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 3);
- assert.equal(
- await capsule.locator("[data-agent-result-badge]").count(),
- runningCount === 2 ? 1 : 0,
- );
- assert.deepEqual(
- await capsule
- .locator("[data-subagent-avatar]")
- .evaluateAll((els) => els.map((el) => el.getAttribute("data-face-state"))),
- runningCount === 2
- ? ["content", "scanning", "scanning"]
- : ["scanning", "scanning", "scanning"],
- );
- assert.equal(
- await capsule.locator("[data-status-capsule-secondary]").innerText(),
- String(runningCount),
- );
- }
- for (const status of ["success", "failed"]) {
- await page.goto(
- getOrigin() +
- `fixture?theme=${theme}&locale=en-US&real=1&endedOnly=1&agentStatus=${status}&configuredColor=1`,
- );
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-subagent-avatar]").count(), 1);
- assert.equal(await faceColor(), "#3C82F6");
- assert.equal(
- await capsule
- .locator("[data-agent-result-badge]")
- .getAttribute("data-agent-result-badge"),
- status === "success" ? "completed" : "failed",
- );
- }
- } finally {
- await page.close();
- }
- });
- }
- }
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`workflow completion survives while bash clears on next input ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- await page.goto(
- getOrigin() + `fixture?theme=${theme}&locale=en-US&real=1&workflow=1&endedOnly=1`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "2");
- await page.getByTestId("dismiss-activity").click();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Completed");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await capsule.click();
- assert.equal(await page.locator("[data-activity-result]").count(), 0);
- await page.getByTestId("outside").click();
- await page.screenshot({
- path: join(artifacts, `activity-completed-retained-${width}-${theme}.png`),
- });
- } finally {
- await page.close();
- }
- });
- }
- }
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`activity failure count resets on accepted input ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- await page.goto(
- getOrigin() + `fixture?theme=${theme}&locale=en-US&real=1&agentStatus=failed`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.waitFor();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Active");
- await page.getByTestId("end-activity").click();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Failed");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await page.screenshot({ path: join(artifacts, `activity-failed-${width}-${theme}.png`) });
- await page.getByTestId("start-terminal").click();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Active");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await page.getByTestId("new-terminal").click();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Failed");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await page.getByTestId("dismiss-activity").click();
- assert.equal(await capsule.locator("[data-capsule-label]").textContent(), "Completed");
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await capsule.click();
- assert.equal(await page.locator('[data-activity-result="failed"]').count(), 0);
- } finally {
- await page.close();
- }
- });
- }
- }
- for (const theme of ["light", "dark"]) {
- test(`all completed actor badges remain unobscured ${theme}`, async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(
- `${getOrigin()}fixture?real=1&workflow=1&endedOnly=1&mixedActors=1&allActorsDone=1&theme=${theme}&locale=en-US`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- const badges = capsule.locator(
- '[data-subagent-avatar] [data-agent-result-badge="completed"]',
- );
- assert.equal(await badges.count(), 3);
- assert.equal(await capsule.locator("[data-agent-result-badge]").count(), 3);
- for (const badge of await badges.all()) {
- assert.equal(
- await badge.evaluate((node) => {
- // Button 默认关闭 SVG 命中;仅为遮挡检测打开,不改变视觉或层级。
- node.ownerSVGElement.style.pointerEvents = "all";
- for (const child of node.querySelectorAll("*")) child.style.pointerEvents = "all";
- const r = node.getBoundingClientRect();
- return node.contains(
- document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2),
- );
- }),
- true,
- );
- }
- await page.screenshot({ path: join(artifacts, `all-actor-badges-${theme}.png`) });
- } finally {
- await page.close();
- }
- });
- }
- for (const theme of ["light", "dark"]) {
- test(`Workflow capsule preserves each actor state ${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width: 390, height: 900 } });
- try {
- await page.goto(
- `${getOrigin()}fixture?real=1&workflow=1&mixedActors=1&theme=${theme}&locale=en-US`,
- );
- const capsule = page.locator('[data-status-capsule="activity"]');
- const avatars = capsule.locator("[data-subagent-avatar]");
- assert.equal(await avatars.count(), 3);
- assert.equal(await capsule.locator('[data-agent-result-badge="completed"]').count(), 1);
- assert.equal(await avatars.nth(0).getAttribute("data-face-state"), "content");
- assert.equal(await avatars.nth(1).getAttribute("data-face-state"), "scanning");
- assert.equal(await avatars.nth(2).getAttribute("data-face-state"), "waiting");
- await page.screenshot({ path: join(artifacts, `individual-actor-${theme}.png`) });
- } finally {
- await page.close();
- }
- });
- }
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`Chinese Activity capsule uses active label ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- await page.goto(`${getOrigin()}fixture?real=1&theme=${theme}&locale=zh-CN`);
- const capsule = page.locator('[data-status-capsule="activity"]');
- // 窄屏按既有响应式规则收起文字,仍用同一中文无障碍名称。
- if (width === 390) assert.equal(await capsule.getAttribute("aria-label"), "活跃中");
- else assert.match(await capsule.innerText(), /活跃/);
- } finally {
- await page.close();
- }
- });
- }
- }
- for (const status of ["success", "failed", "cancelled"]) {
- for (const endedAt of [4, 14]) {
- test(`cold seeded ${status} result respects input boundary ${endedAt}`, async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(
- `${getOrigin()}fixture?real=1&theme=dark&locale=en-US&endedOnly=1&onlySubagentHistory=1&agentStatus=${status}&childEndedAt=${endedAt}`,
- );
- await page.getByTestId("dismiss-activity").click();
- const capsule = page.locator('[data-status-capsule="activity"]');
- await capsule.click();
- await page.getByTestId("activity-subagent-directory").waitFor();
- assert.equal(await page.locator("[data-activity-result]").count(), endedAt > 10 ? 1 : 0);
- if (endedAt <= 10) {
- assert.equal(
- (await capsule.innerText()).replace(/\s+/g, " "),
- `Completed ${status === "success" ? 1 : 0}`,
- );
- assert.equal(
- await page.locator("[data-agent-result-badge]").count(),
- status === "success" ? 1 : 0,
- );
- } else {
- const result = { success: "completed", failed: "failed", cancelled: "stopped" }[status];
- assert.equal(
- await page.locator("[data-activity-result]").getAttribute("data-activity-result"),
- result,
- );
- assert.equal(
- await capsule
- .locator("[data-agent-result-badge]")
- .getAttribute("data-agent-result-badge"),
- result,
- );
- assert.equal(
- await page
- .locator(`[data-activity-result] [data-agent-result-badge="${result}"]`)
- .count(),
- 1,
- );
- }
- } finally {
- await page.close();
- }
- });
- }
- }
- test("accepted input keeps running activity alongside history", async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(`${getOrigin()}fixture?real=1&theme=light&locale=en-US`);
- await page.getByTestId("dismiss-activity").click();
- const capsule = page.locator('[data-status-capsule="activity"]');
- assert.equal(await capsule.locator("[data-status-capsule-secondary]").innerText(), "1");
- await capsule.click();
- await page.getByTestId("activity-subagent-directory").waitFor();
- await page.getByTestId("v4-running-subagent-stop").waitFor();
- } finally {
- await page.close();
- }
- });
- for (const width of [390, 1200]) {
- for (const theme of ["light", "dark"]) {
- test(`previous directories coexist with current completed terminal ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- await page.goto(`${getOrigin()}fixture?real=1&theme=${theme}&locale=en-US&endedOnly=1`);
- await page.getByTestId("dismiss-activity").click();
- await page.getByTestId("new-terminal").click();
- await page.locator('[data-status-capsule="activity"]').click();
- await page.getByText("Current round terminal", { exact: true }).waitFor();
- for (const kind of ["subagent", "workflow"]) {
- if (kind === "workflow") await page.locator('[data-status-capsule="activity"]').click();
- const entry = page.getByTestId(`activity-${kind}-directory`);
- assert.equal(await entry.count(), 1, "本轮结果不能隐藏上一轮目录");
- await entry.click();
- assert.equal(
- await page.locator("output").textContent(),
- `${kind === "subagent" ? "agent" : "workflow"}-history:parent`,
- );
- }
- await page.screenshot({
- path: join(artifacts, `activity-history-current-${width}-${theme}.png`),
- });
- } finally {
- await page.close();
- }
- });
- }
- }
- test("directory visibility follows each archived kind independently", async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(
- `${getOrigin()}fixture?real=1&theme=light&locale=en-US&endedOnly=1&onlySubagentHistory=1`,
- );
- await page.locator('[data-status-capsule="activity"]').click();
- assert.equal(await page.getByTestId("activity-subagent-directory").count(), 0);
- assert.equal(await page.getByTestId("activity-workflow-directory").count(), 0);
- await page.getByTestId("dismiss-activity").click();
- await page.getByTestId("new-terminal").click();
- await page.locator('[data-status-capsule="activity"]').click();
- await page.getByTestId("activity-subagent-directory").waitFor();
- assert.equal(await page.getByTestId("activity-workflow-directory").count(), 0);
- } finally {
- await page.close();
- }
- });
- for (const width of [390, 1280])
- for (const theme of ["light", "dark"]) {
- test(`capsule navigation closes portal ${width}/${theme}`, async () => {
- const page = await getBrowser().newPage({ viewport: { width, height: 900 } });
- try {
- for (const item of [
- {
- capsule: "activity",
- query: "",
- selector: "[data-running-subagent-session-trigger]",
- result: "agent-details",
- },
- {
- capsule: "activity",
- query: "&workflow=1",
- selector: '[data-testid="background-bash-open"]',
- result: "bash-details",
- },
- {
- capsule: "git",
- query: "",
- selector: '[data-testid="status-git-files"] button',
- result: "unstaged:shared.txt",
- },
- {
- capsule: "git",
- query: "",
- selector: '[data-testid="status-git-view-all"]',
- result: "git-details",
- },
- ]) {
- await page.goto(
- getOrigin() + `fixture?real=1&theme=${theme}&locale=en-US` + item.query,
- );
- await page.locator(`[data-status-capsule="${item.capsule}"]`).click();
- await page.locator(item.selector).first().click();
- assert.equal(await page.locator("output").innerText(), item.result);
- await page.locator("[data-status-capsule-content]").waitFor({ state: "hidden" });
- }
- } finally {
- await page.close();
- }
- });
- }
- test("workflow journal distinguishes pending, empty and unavailable; ignores stale response", async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(getOrigin() + "fixture?journalQuery=1");
- await page.getByTestId("query-state").waitFor();
- assert.equal(await page.getByTestId("query-state").innerText(), "loading");
- await page.waitForFunction(() => window.workflowRequests.length === 1);
- await page.getByRole("button", { name: "Switch query" }).click();
- await page.waitForFunction(() => window.workflowRequests.length === 2);
- await page.evaluate(() => window.workflowRequests[0].resolve({ runs: [{ runId: "old" }] }));
- assert.equal(await page.getByTestId("query-state").innerText(), "loading");
- await page.evaluate(() => window.workflowRequests[1].resolve({ runs: [] }));
- await page.waitForFunction(
- () => document.querySelector('[data-testid="query-state"]').textContent === "[]",
- );
- await page.reload();
- await page.waitForFunction(() => window.workflowRequests.length === 1);
- assert.equal(await page.getByTestId("query-state").innerText(), "loading");
- await page.evaluate(() =>
- window.workflowRequests[0].reject(new Error("capabilityUnsupported")),
- );
- await page.waitForFunction(
- () => document.querySelector('[data-testid="query-state"]').textContent === "unavailable",
- );
- } finally {
- await page.close();
- }
- });
- test("workflow actors are counted once alongside terminal tasks", async () => {
- const page = await getBrowser().newPage();
- try {
- await page.goto(getOrigin() + "fixture?theme=light&locale=en-US&real=1&workflow=1");
- const activity = page.locator('[data-status-capsule="activity"]');
- await activity.waitFor();
- assert.equal((await activity.innerText()).replace(/\s+/g, " "), "Active 2");
- assert.equal(await activity.locator("[data-status-capsule-secondary]").innerText(), "2");
- const secondarySizes = await page
- .locator("[data-status-capsule-secondary]")
- .evaluateAll((nodes) => nodes.map((node) => getComputedStyle(node).fontSize));
- assert.ok(secondarySizes.length >= 4);
- assert.ok(secondarySizes.every((size) => size === "12px"));
- await activity.click();
- assert.equal(await page.getByTestId("v4-running-subagent-item").count(), 0);
- assert.deepEqual(
- await page
- .locator("[data-activity-id]")
- .evaluateAll((nodes) => nodes.map((n) => n.dataset.activityId)),
- ["workflow:run", "bash:shell"],
- );
- await page.locator("[data-workflow-run-details-trigger]").click();
- assert.equal(await page.locator("output").innerText(), "workflow-details");
- await page.locator('[data-status-capsule-content="activity"]').waitFor({ state: "hidden" });
- } finally {
- await page.close();
- }
- });
- }
- export const workflowQueryFixture = `const requests=[];
- window.workflowRequests=requests;
- const queryContext={workflowRuns:()=>new Promise((resolve,reject)=>requests.push({resolve,reject}))};
- function QueryProbe(){
- const [session,setSession]=useState("a");
- const data=useWorkflowRunJournalSummaries({sessionId:session,live:true});
- return <><button onClick={()=>setSession("b")}>Switch query</button><output data-testid="query-state">{data===undefined?"loading":data===null?"unavailable":JSON.stringify(data)}</output></>;
- }
- `;
|