| 1234567891011121314151617181920 |
- import { test, expect } from "@playwright/test"
- import { writeFileSync } from "node:fs"
- test("production workbench task admission benchmark", async ({ page }) => {
- const samples: number[] = []
- await page.goto("/e2e/paas/index.html?ux")
- await page.getByLabel("API Key", { exact: true }).fill("synthetic")
- await page.getByRole("button", { name: "连接平台", exact: true }).click()
- for (let i = 0; i < 5; i++) {
- await page.getByRole("textbox", { name: "消息", exact: true }).fill(`基准任务 ${i}`)
- const start = performance.now()
- await page.getByRole("button", { name: "发送消息", exact: true }).click()
- await expect(page.getByRole("button", { name: "暂停", exact: true })).toBeVisible()
- samples.push(performance.now() - start)
- await page.locator(".paas-topbar-chat-actions").getByRole("button", { name: "新会话", exact: true }).click()
- }
- writeFileSync(
- process.env.BENCH_OUTPUT || "/private/tmp/lambda-task-baseline.json",
- JSON.stringify({ samples, mean: samples.reduce((a, b) => a + b, 0) / samples.length }),
- )
- })
|