Artillery集成Playwright压测时超时配置不生效,仍触发30秒超时问题求助
Artillery集成Playwright压测时超时配置不生效,仍触发30秒超时问题求助
我最近尝试用Artillery结合Playwright做压测,明明在配置里把超时时间设置成了240秒,但实际运行时,page.goto还是触发了30秒的超时错误,配置的参数完全没起作用,实在摸不着头脑,来求助各位大佬!
以下是我的压测代码loadTest.spec.ts:
import {Page, test, expect} from '@playwright/test'; export const config = { target: 'www.google.com', engines: { playwright: { // Timeout for each request in milliseconds timeout: 240000, // Default timeout for Playwright actions defaultTimeout: 240, version: 'latest', extendedMetrics: true, browser: 'chromium', launchOptions: { headless: true }, trace: true, // Enable tracing for debugging } }, phases: [{ name: 'Load Test Phase', duration: 300, // Duration of the test in seconds arrivalRate: 5, // Number of new virtual users per second rampTo: 5 // Ramp up to 10 users over the duration }], }; async function loadtesting(page: Page) { // Load testing scenarios await tontonSSOLogin(page); } async function tontonSSOLogin(page: Page) { await page.goto('https://www.google.com'); // https://watch-mediaprima-uat.switch.tv/login //await page.fill('input[name="username"]', 'Admin'); //await page.fill('input[name="password"]', 'admin123'); //await page.click('button[type="submit"]'); } export const scenarios = [{ engine: 'playwright', testFunction: loadtesting }];
运行后还是会出现30秒超时的错误,错误日志如下:
page.goto: Timeout 30000ms exceeded. Call log: - navigating to "https://www.google.com", waiting until "load" at tontonSSOLogin (C:\Users\nicholaswkc\Documents\GitHub\TontonSSOLogin\tests\dist\loadTest.spec.ts.js:58:14) at loadtesting (C:\Users\nicholaswkc\Documents\GitHub\TontonSSOLogin\tests\dist\loadTest.spec.ts.js:55:9) at Array.scenario (C:\Users\nicholaswkc\AppData\Local\npm-cache\_npx\1196d833f288caa4\node_modules\artillery-engine-playwright\index.js:378:17) { name: 'TimeoutError' }
我已经检查过配置里的超时参数,timeout设成了240000毫秒(240秒),defaultTimeout也设了240,但看起来Playwright的页面跳转还是用了默认的30秒超时。是不是我在Artillery里的配置方式不对?或者需要在Playwright的操作里单独设置超时?
内容来源于stack exchange
相关产品推荐
相关产品推荐

