Skip to content

Commit

Permalink
Fix: JS処理が間に合わないフレーキーテストに対処した
Browse files Browse the repository at this point in the history
Capybaraアサーションが失敗したときに、Capybaraは自動で再試行を行う。
この再試行は、デフォルトで2秒まで待ってから実行してくれる。
このパッチにより、待つ時間を5秒まで許可するようにした。

失敗したときにのみ効果があるので、テスト全体が遅くなることもない。
  • Loading branch information
yonta committed Jul 1, 2024
1 parent 0b20705 commit 05d3714
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

# "data-testid"をCapybaraのclick_linkなどで使えるように、Optional attributeに登録する
config.test_id = "data-testid"

# Capybaraのアサーションが失敗したときに自動再試行する時間
# JS処理が間に合わないなどフレーキーなテストへの対応するため少し長くする
config.default_max_wait_time = 5
end

RSpec.configure do |config|
Expand Down

0 comments on commit 05d3714

Please sign in to comment.