Skip to content

Commit

Permalink
Simplify capybara wait time helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Dec 16, 2024
1 parent 20b51cb commit e28a66f
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 28 deletions.
2 changes: 1 addition & 1 deletion spec/features/item_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
item.click_button 'Make public'
end

it "toggles the 'blacklight-private' label", default_max_wait_time: 5, js: true do
it "toggles the 'blacklight-private' label", max_wait_time: 5, js: true do
visit spotlight.admin_exhibit_catalog_path(exhibit)
# The label should be toggled when the checkbox is clicked
expect(page).to have_no_css('tr.blacklight-private')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

describe 'Oembed and text block', default_max_wait_time: 15, feature: true, versioning: true do
describe 'Oembed and text block', max_wait_time: 15, feature: true, versioning: true do
let(:exhibit) { FactoryBot.create(:exhibit) }
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit:) }
let(:feature_page) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe 'Solr Document Block', default_max_wait_time: 30, feature: true, versioning: true do
RSpec.describe 'Solr Document Block', max_wait_time: 30, feature: true, versioning: true do
let(:exhibit) { FactoryBot.create(:exhibit) }
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit:) }
let(:feature_page) do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/javascript/edit_in_place_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
end
end

it 'updates the metadata label', default_max_wait_time: 10 do
it 'updates the metadata label', max_wait_time: 10 do
visit spotlight.exhibit_dashboard_path(exhibit)

within '#sidebar' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/javascript/multi_image_select_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe 'Multi image selector', default_max_wait_time: 5, js: true, type: :feature, versioning: true do
RSpec.describe 'Multi image selector', max_wait_time: 5, js: true, type: :feature, versioning: true do
let(:exhibit) { FactoryBot.create(:exhibit) }
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit:) }
let(:feature_page) { FactoryBot.create(:feature_page, exhibit:) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/javascript/reindex_monitor_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

describe 'Reindex Monitor', default_max_wait_time: 10, js: true do
describe 'Reindex Monitor', max_wait_time: 10, js: true do
let(:resources) do
FactoryBot.create_list(:resource, 1)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/javascript/search_config_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

before { login_as user }

describe 'search fields', default_max_wait_time: 5 do
describe 'search fields', max_wait_time: 5 do
it 'allows the curator to disable all search fields' do
visit spotlight.exhibit_home_page_path(exhibit, exhibit.home_page)
expect(page).to have_css 'select#search_field'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
config.include Rails.application.routes.url_helpers
config.include Rails.application.routes.mounted_helpers
config.include Spotlight::TestFeaturesHelpers, type: :feature
config.include CapybaraDefaultMaxWaitMetadataHelper, type: :feature
config.include CapybaraWaitMetadataHelper, type: :feature

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
Expand Down
20 changes: 0 additions & 20 deletions spec/support/features/capybara_default_max_wait_metadata_helper.rb

This file was deleted.

13 changes: 13 additions & 0 deletions spec/support/features/capybara_wait_metadata_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module CapybaraWaitMetadataHelper
extend ActiveSupport::Concern

included do
around do |example|
using_wait_time example.metadata[:max_wait_time] || Capybara.default_max_wait_time do
example.run
end
end
end
end

0 comments on commit e28a66f

Please sign in to comment.