ADR: 自動テスト(Selenium)実行中であることをアプリケーション内で検知可能にする #32
takaokouji
started this conversation in
ADR (Any Decision Record)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context and Problem Statement - コンテキストと問題の説明
Seleniumでのファイルアップロード時にブラウザのダイアログが開くと制御が困難になるため、テスト時のみこの挙動を抑制したい。
Decision Date - 決定日付
2026/01/25
Decision Makers - 意思決定者
@takaokouji
Decision Drivers - 決定要因
Considered Options - 検討した選択肢
案1: URLパラメータによる判定(推奨)
SeleniumHelper.loadUri で読み込むURLに、テスト用フラグ(例: ?seleniumTest=true)を付与し、HOC内でそれを判定します。
案2: navigator.webdriver による判定
多くのモダンブラウザが提供している、自動操縦下にあることを示す標準プロパティを参照します。
案3: グローバル定数(windowプロパティ)による判定
Seleniumから executeScript を用いて、初期化時に window.IS_SELENIUM = true といった値を注入します。
Decision - 決定
内容
理由
Consequences - 結果
―
Confirmation - 確認
―
Pros and Cons of the Options - 選択肢の長所と短所
Seleniumから
<input type="file">に対して直接 sendKeys(path) を行えるようになり、テストの安定性が向上した。More Information - 詳細情報
―
Beta Was this translation helpful? Give feedback.
All reactions