Error when trying `run-workers` with combination of `channel` using playwright helper.

未关闭
#4,609 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, node.js, playwright

调研方向

首先,在 win32 上使用 Playwright helper、channel: 'msedge' 和 npx codeceptjs run-workers 2,于一个演示 CodeceptJS 项目中重现该问题。检查 run-workers 子进程的环境处理,并验证 channel 浏览器在并行执行期间能够成功启动。

由索引模型根据 Issue 内容生成。

描述

What are you trying to achieve?

When I use Playwright driver along with channel, and also use run-workers, I get error like the browser exe file is not present at specific location and browser cannot be launched.

How to reproduce?
  1. Create a demo codeceptjs project with playwright as driver.
  2. In codecept.conf.js file add the channel property inside playwright object (add any property from here) OR use below code.
const { setHeadlessWhen, setCommonPlugins } = require('@codeceptjs/configure');
// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

/** @type {CodeceptJS.MainConfig} */
exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    Playwright: {
      browser: 'chromium',
      url: 'http://localhost',
      show: true,
      channel: 'msedge',
    }
  },
  include: {
    I: './steps_file.js'
  },
  name: 'demo-codecept'
}
Command for execution

npx codeceptjs run-workers 2

Possible resolution way and reason for Error

The error comes when child processes are created for the parallel execution using run-workers. For windows operating system, the env variable are case-insensitive, which means process.env['PROGRAMFILES(X86)'] and process.env['ProgramFiles(x86)'] would produce same output. But inside the child process, only writing exact case only produces result. ex. process.env['ProgramFiles(x86)'] will produce correct output and anything other produces undefined.
Because of this it is not able to find the correct path at which the browser exe files are present.

Details
  • CodeceptJS version: 3.6.6
  • NodeJS Version: 22.11.0
  • Operating System: win32
  • playwright: 1.49.0
主要语言
JavaScript
星标
4.2k
派生
756
平均合并
2 天 9 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。