import { Page } from "@playwright/test";
export const config = {
target: "https://www.artillery.io",
defaults: {
capture: {
response: ["status_code", "latency"],
metrics: [
"http.response_time.p50",
"http.response_time.p95",
"http.response_time.p99",
"http.response_time.min",
"http.response_time.max",
"http.request_rate",
"http.codes.200",
"http.codes.4xx",
"http.codes.5xx",
],
},
},
plugins: {
expect: { enabled: true },
ensure: {
thresholds: {
"browser.page.TTFB.https://www.artillery.io/": { p95: 100 },
"vusers.session_length.min": 1000,
"browser.page.codes.404": 0,
},
},
},
engines: {
playwright: { showAllPageMetrics: false },
},
phases: [{ duration: 10, arrivalRate: 1, name: "Usersarrival" }],
};
export const scenarios = [
{
engine: "playwright",
testFunction: helloWorld,
},
];
export async function helloWorld(page: Page) {
await page.goto("https://www.artillery.io/");
await page.click("text=Docs");
}
sissue: 我希望在我的报告中看到http.response_time.p50,http.response_time.p95等。但是,当我运行测试时,我只会得到浏览器级指标:
设置没有效果,因为它不是炮兵的公认配置选项。 (看起来可能是由AI副驾驶建议的?)
您没有看到该块中定义的the-prefix的指标,因为基于剧作家的测试不会捕获这些指标。您可以在此处的官方文档中查看这些测试报告的指标列表:
Https://www.artillery.io/docs/reference/reference/Engines/playwright#metrics-reported-by-the-the-wengine-