2026-11-13 19:16:03 +08:00
|
|
|
import { expect, test } from "@playwright/test";
|
|
|
|
|
|
|
|
|
|
for (const width of [1280, 360]) {
|
|
|
|
|
test(`shows command activity and keeps long check histories inspectable at ${width}px`, async ({ page }) => {
|
|
|
|
|
await page.setViewportSize({ width, height: 720 });
|
|
|
|
|
await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en"));
|
|
|
|
|
await page.goto("/browser/fixture.html?case=exec-session");
|
|
|
|
|
const activity = page.getByRole("region", { name: "Command activity" });
|
2026-11-17 17:22:25 +08:00
|
|
|
await expect(activity).toContainText("Waiting for command curl -u •••• https://example.invalid");
|
2026-11-13 19:16:03 +08:00
|
|
|
await page.getByRole("button", { name: "running", exact: true }).click();
|
2026-11-17 17:22:25 +08:00
|
|
|
await expect(activity).toContainText("Command still running curl -u •••• https://example.invalid");
|
2026-11-13 19:16:03 +08:00
|
|
|
await page.getByRole("button", { name: "input", exact: true }).click();
|
|
|
|
|
await expect(activity).toContainText("Sent input curl -u •••• https://example.invalid");
|
|
|
|
|
await page.getByRole("button", { name: "failed", exact: true }).click();
|
2026-11-17 17:22:25 +08:00
|
|
|
await expect(activity).toContainText("Command failed (exit 7) curl -u •••• https://example.invalid");
|
2026-11-13 19:16:03 +08:00
|
|
|
await page.getByRole("button", { name: "many", exact: true }).click();
|
2026-11-17 17:22:25 +08:00
|
|
|
await expect(activity.getByTestId("latest-activity-wheel")).toContainText("Command still running");
|
2026-11-14 13:40:11 +08:00
|
|
|
await activity.getByRole("button", { name: /^Working for / }).click();
|
2026-11-17 17:22:25 +08:00
|
|
|
const disclosure = activity.getByRole("button", { name: "Show 24 earlier checks" });
|
2026-11-13 19:16:03 +08:00
|
|
|
await expect(activity.getByTestId("activity-step")).toHaveCount(1);
|
|
|
|
|
await disclosure.click();
|
|
|
|
|
await expect(activity.getByTestId("activity-step")).toHaveCount(25);
|
2026-11-17 17:22:25 +08:00
|
|
|
await activity.getByRole("button", { name: "Hide 24 earlier checks" }).click();
|
2026-11-13 19:16:03 +08:00
|
|
|
await expect(activity.getByTestId("activity-step")).toHaveCount(1);
|
|
|
|
|
await expect(activity).not.toContainText("012345abcdef");
|
|
|
|
|
await expect(activity).not.toContainText("private-stdin");
|
|
|
|
|
await expect(activity).not.toContainText("secret-value");
|
|
|
|
|
expect(await activity.innerHTML()).not.toContain("secret-value");
|
|
|
|
|
expect(await activity.innerHTML()).not.toContain("012345abcdef");
|
|
|
|
|
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBe(width);
|
|
|
|
|
});
|
|
|
|
|
}
|