Skip to content

Commit

Permalink
Try to fix system test
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-isler committed Nov 12, 2024
1 parent 316fcd9 commit 9661987
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
require "rspec/rails"
require "selenium-webdriver"

require "support/capybara_utils"

%i[firefox firefox_headless].each do |driver|
Capybara.register_driver driver do |app|
args = ["--headless"] if driver == :firefox_headless
Expand All @@ -23,7 +25,8 @@
RSpec.configure do |config|
Kernel.srand config.seed

config.include Capybara::DSL
config.include Capybara::DSL, type: :system
config.include CapybaraUtils, type: :system

config.disable_monkey_patching!
config.filter_rails_from_backtrace!
Expand Down
9 changes: 9 additions & 0 deletions spec/support/capybara_utils.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module CapybaraUtils
def wait_for_turbo(timeout = nil)
return unless has_css?(".turbo-progress-bar", visible: true, wait: 1.second)

has_no_css?(".turbo-progress-bar", wait: timeout.presence || 5.seconds)
end
end
2 changes: 2 additions & 0 deletions spec/system/editable_attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
before do
visit "/hotsheet"
click_link "Author"

wait_for_turbo
find(".readonly-attribute", text: "Stephen").click
fill_in "author_name", with: "King"
end
Expand Down

0 comments on commit 9661987

Please sign in to comment.