[Feature]: OptionsFactory that has access to test instance fields

オープン
#1,881 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java
領域
testing-qa

調査の方向性

まず、@UsePlaywright OptionsFactory の統合を追跡し、テストインスタンスとの関係でどのように初期化されるかを確認します。注入された EmbeddedServer を使用する例を確認し、インスタンスフィールドにアクセスするために必要なライフサイクルを特定します。Options が実行中のテストの値を使用でき、既存の @UsePlaywright の動作が引き続きサポートされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

🚀 Feature Request

I'd like the ability to populate Options for use with @UsePlaywright with values that are determined by the running test, not just statically.

The OptionsFactory approach to customizing @UsePlaywright has a big gap - it can't access instance fields of the test. A non-static inner class doesn't work as it requires the outer class as a constructor argument.

Example
@UsePlaywright
@MicronautTest
class MyTest {

  @Inject
  EmbeddedServer server;

  Options getOptions() {
    return new Options().setBaseUrl(server.getUrl())
  }

  @Test
  void myTest(Page page) {
  }
}
Motivation

I'm trying to use Playwright with a fake server (Spring MockMVC, Micronaut EmbeddedServer, etc). These approaches all inject a server into an instance field of the test class, and one retrieves the base URL from that server. However, OptionsFactory is initialized outside of the test instance scope, and so can't make use of that injected server.

主要言語
Java
スター
1.6k
フォーク
298
平均マージ
3日 2時間
マージ済み PR(30日)
14

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright-java のほかの issue

microsoft/playwright-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。