团队和AI代理的开源视觉测试平台.
官方Argos Playwright 整合
从您手中抓取稳定的 Argos 截图 剧作家 向Argos报告故障截图和痕迹.
访问 剧作家 SDK 文档 用于向导,API参考,以及更多.
安装
npm install --save-dev @argos-ci/playwright
使用量
在您的 Playwright 配置中设置 Argos 记者 :
// playwright.config.ts
import { defineConfig } from "@playwright/test";
import { createArgosReporterOptions } from "@argos-ci/playwright/reporter";
export default defineConfig({
// ... other configuration
reporter: [
// Use "dot" reporter on CI, "list" otherwise (Playwright default).
process.env.CI ? ["dot"] : ["list"],
// Add the Argos reporter.
[
"@argos-ci/playwright/reporter",
// Upload the screenshots to Argos only on CI.
createArgosReporterOptions({ uploadToArgos: !!process.env.CI }),
],
],
});
然后用 argosScreenshot 在测试中:
// tests/example.spec.ts
import { test } from "@playwright/test";
import { argosScreenshot } from "@argos-ci/playwright";
test("screenshot homepage", async ({ page }) => {
await page.goto("http://localhost:3000");
await argosScreenshot(page, "homepage");
});