@eyeauras/workbench-testing
用 EyeAuras UI Workbench 构建的应用程序的共享 Playwright 默认. 作为开发安装 工具; 这不是工作区框架的运行时间依赖.
npm install --save-dev @eyeauras/[email protected] @playwright/[email protected] @types/node
软件包安装匹配的无头铬构件, 意外的测试失败
console.error 或未发现的页面错误,并提供保守的默认值通过
defineWorkbenchPlaywrightConfig消费者仍然拥有 testDir, (中文(简体) ), baseURL, (中文(简体) ), webServer选择者,
应用程序固定装置,以及任何可选的 BDD 设置.
// playwright.config.ts
import { defineWorkbenchPlaywrightConfig } from "@eyeauras/workbench-testing";
export default defineWorkbenchPlaywrightConfig({
testDir: "./tests/ui",
use: { baseURL: "http://127.0.0.1:4175" },
webServer: {
command: "npm run dev -- --host 127.0.0.1 --port 4175 --strictPort",
url: "http://127.0.0.1:4175",
reuseExistingServer: false,
},
});
// tests/ui/example.spec.ts
import { expect, test } from "@eyeauras/workbench-testing";
test("opens the editor", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("main")).toBeVisible();
});
正常跑道为无头和单工. 使用 Playwright 软件 --headed 交互式诊断时的旗帜
这是故意的。 生成了 HTML 报告,但从未自动打开.
此示例假设 Vite 应用程序带有 npm run dev 剧本. 运行 npx playwright test
从消费者。 Linux 上安装 Playwright 系统依赖性一次
npx playwright install-deps chromium。测试工具需要支持的主机节点版本
项目;没有添加React、Tauri或Workbench运行时间依赖.