Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
perf(ci): reduce WebUI browser test overhead (#6580)
chengyongrufdd30e6dc96e
diff --git a/webui/browser/skeleton-layout.spec.ts b/webui/browser/skeleton-layout.spec.tsindex d51d7b852..c66e283d5 100644--- a/webui/browser/skeleton-layout.spec.ts+++ b/webui/browser/skeleton-layout.spec.ts@@ -84,31 +84,36 @@ for (const width of [390, 1440]) {});await page.route("**/api/webui/skills/trends?**", (route) => route.fulfill({ json: { trends: {} } }));for (const view of ["grouped", "single", "search"]) {- const open = async () => {+ pending = new Promise<void>((resolve) => { release = resolve; });+ const requested = page.waitForRequest(view === "search" ? "**/api/webui/skills/search?**" : "**/api/webui/skills/trending?**");+ try {await page.goto(fixture("marketplace"));if (view === "single") await page.getByRole("tab", { name: "skills.sh", exact: true }).click();if (view === "search") await page.locator("input").fill("project");- };- await open();- const loaded = page.locator(".group.py-3\\.5");- await expect(loaded).toHaveCount(view === "single" ? 5 : 10);- const rows = await loaded.evaluateAll((elements) => elements.map((element) => {- const r = element.getBoundingClientRect();- const text = element.querySelector("h3")!.parentElement!.parentElement!.getBoundingClientRect();- return { row: { x: r.x, y: r.y, width: r.width, height: r.height }, text: { x: text.x, width: text.width } };- }));- pending = new Promise<void>((resolve) => { release = resolve; });- try {- await open();+ await requested;const skeletons = status(page).locator(".py-3\\.5");- await expect(skeletons).toHaveCount(rows.length);- for (let index = 0; index < rows.length; index++) {- sameBox(await box(skeletons.nth(index)), rows[index].row);+ const count = view === "single" ? 5 : 10;+ await expect(skeletons).toHaveCount(count);+ const placeholders = [];+ for (let index = 0; index < count; index++) {+ const row = await box(skeletons.nth(index));const text = await box(skeletons.nth(index).locator(".flex-1"));- expect(text.x).toBe(rows[index].text.x);- expect(text.width).toBe(rows[index].text.width);+ placeholders.push({ row, text });}await noOverflow(page);+ release();+ const loaded = page.locator(".group.py-3\\.5");+ await expect(loaded).toHaveCount(count);+ const rows = await loaded.evaluateAll((elements) => elements.map((element) => {+ const r = element.getBoundingClientRect();+ const text = element.querySelector("h3")!.parentElement!.parentElement!.getBoundingClientRect();+ return { row: { x: r.x, y: r.y, width: r.width, height: r.height }, text: { x: text.x, width: text.width } };+ }));+ for (let index = 0; index < count; index++) {+ sameBox(placeholders[index].row, rows[index].row);+ expect(placeholders[index].text.x).toBe(rows[index].text.x);+ expect(placeholders[index].text.width).toBe(rows[index].text.width);+ }} finally { release(); pending = undefined; }await page.goto("about:blank");}@@ -125,23 +130,24 @@ for (const width of [390, 1440]) {...(provider === "anthropic" ? { label: `Project ${index}`, description: "Code assistance" } : {}) })) } });});for (const surface of ["models", "models-compact"]) {- await page.goto(fixture(surface));- await page.getByRole("combobox").click();- const loaded = page.getByRole("option").first();- await expect(loaded).toBeVisible();- await settle(page);- const row = await box(loaded);- const icon = await box(loaded.locator(":scope > :first-child > :first-child"));pending = new Promise<void>((resolve) => { release = resolve; });try {await page.goto(fixture(surface));+ const requested = page.waitForRequest("**/api/settings/provider-models?**");await page.getByRole("combobox").click();+ await requested;await expect(status(page)).toBeVisible();await settle(page);const skeleton = status(page).locator(".px-2.py-1\\.5").first();- sameBox(await box(skeleton), row);- sameBox(await box(skeleton.locator(":scope > :first-child")), icon);+ const row = await box(skeleton);+ const icon = await box(skeleton.locator(":scope > :first-child"));await noOverflow(page);+ release();+ const loaded = page.getByRole("option").first();+ await expect(loaded).toBeVisible();+ await settle(page);+ sameBox(row, await box(loaded));+ sameBox(icon, await box(loaded.locator(":scope > :first-child > :first-child")));} finally { release(); pending = undefined; }await page.goto("about:blank");}diff --git a/webui/playwright.config.ts b/webui/playwright.config.tsindex da6d7f1c5..931040911 100644--- a/webui/playwright.config.ts+++ b/webui/playwright.config.ts@@ -1,3 +1,4 @@+import { availableParallelism } from "node:os";import { defineConfig, devices } from "@playwright/test";const port = Number(process.env.NANOBOT_BROWSER_TEST_PORT ?? 4178);@@ -5,7 +6,7 @@ const port = Number(process.env.NANOBOT_BROWSER_TEST_PORT ?? 4178);export default defineConfig({testDir: "./browser",fullyParallel: false,- workers: 2,+ workers: process.env.CI ? Math.min(3, availableParallelism()) : 2,retries: 0,timeout: 30_000,reporter: "list",