codeceptjs / codeceptjs/CodeceptJS
Error when trying `run-workers` with combination of `channel` using playwright helper.
- Ngôn ngữ chính
- JavaScript
- Star
- 4.2k
- Fork
- 757
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 16
Mô tả
#### 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](https://playwright.dev/docs/api/class-testoptions#test-options-channel)) OR use below code.
```js
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`
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề trong một dự án CodeceptJS demo sử dụng helper Playwright, channel: 'msedge', và `npx codeceptjs run-workers 2` trên win32. Kiểm tra cách xử lý môi trường của tiến trình con `run-workers` và xác minh rằng trình duyệt channel khởi chạy thành công trong quá trình thực thi song song.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js, playwright
- Lĩnh vực
- operating-systems, testing-qa
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100