| 1234567891011121314151617181920 |
- import { expect, test } from "@playwright/test"
- import { writeFile } from "node:fs/promises"
- test("desktop production task navigation benchmark", async ({ page }) => {
- const samples: number[] = []
- for (let index = 0; index < 3; index++) {
- await page.goto("/e2e/paas/index.html?completed&unified")
- await page.getByLabel("API Key", { exact: true }).fill("benchmark")
- const start = Date.now()
- await page.getByRole("button", { name: "连接平台", exact: true }).click()
- await expect(page.getByRole("textbox", { name: "消息", exact: true })).toBeVisible()
- await page.getByRole("textbox", { name: "消息", exact: true }).fill("整理研究材料")
- await page.getByRole("textbox", { name: "消息", exact: true }).press("Enter")
- await expect(page.locator(".paas-report").first()).toBeVisible()
- samples.push(Date.now() - start)
- }
- await writeFile(
- process.env.PAAS_BENCHMARK_OUTPUT || "/private/tmp/desktop-product-benchmark.json",
- JSON.stringify({ samples, median: [...samples].sort((a, b) => a - b)[1] }),
- )
- })
|