You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在AWS Batch CI环境中运行Playwright测试无法启用多Worker的配置问题求助

在AWS Batch CI环境中运行Playwright测试无法启用多Worker的配置问题求助

我现在遇到一个棘手的问题,想在AWS Batch这个CI环境里用多Worker运行JavaScript版的Playwright测试,但一直没法成功启用多Worker,想请教下有没有遗漏的配置?

先说说我的当前配置,我的playwright.config.js内容如下:

export default defineConfig({
  testDir: './playwright/tests',
  globalSetup: path.resolve(__dirname, './global-setup.js'),
  timeout: 120_000,    /* Maximum time one test can run for. */
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  workers: process.env.CI ? 1 : undefined,
});

本地在VSCode里运行的时候,Playwright会自动根据我运行的用例文件数量来分配Worker数量,比如我执行这条命令:

npx playwright test ./tests/BankAccountPage ./tests/TxnAndC* --headed --reporter=html

终端会显示Running 78 tests using 2 workers,如果我加更多用例文件,Worker数量也会自动增加,完全符合预期。

但是把这套配置部署到AWS Batch之后,不管怎么跑,Playwright都只使用1个Worker,完全没有启用多Worker并行的效果。我原本期望它能像本地一样自动判断并启用多Worker,或者至少能配置成多Worker运行,但现在一直没成功。

有没有大佬知道我在AWS Batch环境里是不是漏了什么配置?或者有没有针对这种环境的特殊设置?麻烦帮忙指点一下,非常感谢!

备注:内容来源于stack exchange,提问作者Sriram Muthuswamy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 13:18:08