microsoft / microsoft/playwright-java
[Feature]: Java / JUnit - add possibility to configure default timeout
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 1.6k
- Fork
- 298
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 14
Mô tả
🚀 Feature Request
Status Quo
JUnit support (https://playwright.dev/java/docs/junit) allows to inject a pre-configured instances of Page, BrowserContext, etc. into a test method. Users are able to configure various settings, but not the default timeout on the BrowserContext. As a result, users must call context.setDefaultTimeout or page.setTimout on each injected instance, which is both error prone and increases the amount of ceremonies inside the test code, distracting from its business goals.
Improvement Suggestion
Extend com.microsoft.playwright.junit.Options or com.microsoft.playwright.Browser.NewContextOptions with possibility to set the default timeout. The latter would probably be a better choice, as it would also cover non-JUnit environments, where NewContextOptions could be centrally populated.
Example
In the test class - same as today:
@UsePlaywright(MyOptions.class)
class MyTest {
...
}
In the OptionsFactory - new possibility to set the default timeout:
class MyOptions extends OptionsFactory {
@Override
public Options getOptions() {
return new Options()
....
.setContextOptions(
new Browser.NewContextOptions()
....
.setDefaultTimeout(10_000)
);
}
Motivation
Provide users with possibility to centrally manage all defaults for the created BrowserContext / Page.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với API hỗ trợ JUnit, đặc biệt là com.microsoft.playwright.junit.Options và OptionsFactory, sau đó kiểm tra Browser.NewContextOptions. Xác định tùy chọn nào nên sở hữu timeout mặc định và nó được truyền đến các instance BrowserContext và Page được inject như thế nào. Công việc được hoàn tất khi người dùng có thể cấu hình timeout một cách tập trung thông qua pattern OptionsFactory được trình bày, bao gồm cả bên ngoài JUnit, nơi NewContextOptions được sử dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- testing-qa
- Loại issue
- Tính năng
- Độ 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
- 35/100