microsoft / microsoft/playwright-java
[Feature]: Java / JUnit - add possibility to configure default timeout
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 1.6k
- フォーク
- 298
- 平均マージ
- 3日 2時間
- マージ済み PR(30日)
- 14
説明
🚀 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.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず JUnit のサポート API、特に com.microsoft.playwright.junit.Options と OptionsFactory から始め、次に Browser.NewContextOptions を調べます。どのオプションがデフォルトのタイムアウトを所有すべきか、またそれが注入される BrowserContext および Page インスタンスにどのように到達するかを判断してください。ユーザーが、示されている OptionsFactory パターンを通じてタイムアウトを一元的に設定でき、NewContextOptions が使用される JUnit の外部でも設定できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- testing-qa
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100