Allow custom wsEndpoint for Playwright
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
### Command
build
### Description
In our project, I've been trying to set up visual regression testing using Vitest, and to make the screenshot tests stable, we want to make those tests in the same environment, regardless of the developers' OS, which can impact the tests. When using Playwright as a browser provider, Vites allows for providing/overriding the WS endpoint, which is not respected & overridden in the unit test builder.
After a quick look at the code, presumably this is being dropped in `browser-provider.ts:164-87` - `providerFactory(..)` function is called with only `baseOptions`, and also, `plugins.ts:265-284` has some more overrides, and comments (`// CLI provider browser options override, if present`)
### Describe the solution you'd like
Ideally, as a developer, I'd like to have better control over the browser provider configuration, instead of having it implicitly overridden on the builder side.
These are the options that I have on my mind, both of them backward compatible with the existing API:
1. Allow full customization for the browser provider
The solution is as simple as not overriding the provider value if defined explicitly in `vitetest-base.config.ts`. This option would be backward compatible with the existing API, but might break the projects that've attempted to override the provider property and haven't noticed that it has no impact.
2. Add `wsEndpoint` property to the builder schema, and allow overriding the value from `angular.json`
Safer solution, but less flexible.
### Describe alternatives you've considered
All other alternatives require significant efforts to support, and require bypassing the Angular builders, or using a different framework for the same purpose.
I'm also happy to make a contribution, but first, I'd like to get an opinion, and maybe get more context on why the browser config is overridden from Angular's side.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng việc đọc browser-provider.ts quanh các dòng 164-187, đặc biệt là providerFactory, sau đó kiểm tra các ghi đè provider trong plugins.ts quanh các dòng 265-284. Theo dõi cách cấu hình Playwright được truyền đến Angular builder và xác định tùy chọn tương thích ngược nào là phù hợp. Hoàn tất khi wsEndpoint được cấu hình rõ ràng được tôn trọng thay vì bị ghi đè ngầm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, playwright, typescript
- Lĩnh vực
- build-system, testing-qa, tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100