Skip to content

Commit

Permalink
Only use selenium when js is required
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 13, 2024
1 parent 005ee85 commit d0a54f3
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 29 deletions.
9 changes: 5 additions & 4 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
end

config.before(:each, type: :system) do
Selenium::WebDriver.logger.ignore(:deprecations)
Capybara.server = :puma, {Silent: true}
driven_by :selenium, using: :headless_chrome
driven_by :rack_test
end

config.before(:each, type: :system, js: true) do
driven_by :selenium_chrome_headless
end
end

Capybara.configure do |config|
config.default_set_options = {clear: :backspace}
config.exact_text = true
end

Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/books/admin_deletes_book_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:book) { FactoryBot.create(:book) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/books/#{book.id}"

dismiss_confirm { click_on "Delete Book" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_book_path(book)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/books/#{book.id}"

accept_confirm { click_on "Delete Book" }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/csv_uploads/admin_creates_csv_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
expect(page).to have_current_path new_crud_csv_upload_path
end

scenario "create with parser error" do
scenario "create with parser error", js: true do
visit "/crud/csv_uploads/new"
click_on "create"
select = page.find("#csv_upload_parser_class_name")
error_message = select.native.attribute("validationMessage")
expect(error_message).to eq "Please select an item in the list."
end

scenario "create with file error" do
scenario "create with file error", js: true do
visit "/crud/csv_uploads/new"
select "WellsFargoParser", from: "csv_upload_parser_class_name"
click_on "create"
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/csv_uploads/admin_deletes_csv_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:csv_upload) { FactoryBot.create(:csv_upload) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/csv_uploads/#{csv_upload.id}"

dismiss_confirm { click_on "Delete CSV Upload" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_csv_upload_path(csv_upload)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/csv_uploads/#{csv_upload.id}"

accept_confirm { click_on "Delete CSV Upload" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
expect(page).to have_current_path new_crud_financial_account_path
end

scenario "create with category error" do
scenario "create with category error", js: true do
visit "/crud/financial_accounts/new"
click_on "create"
select = page.find("#financial_account_category")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:financial_account) { FactoryBot.create(:financial_account) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/financial_accounts/#{financial_account.id}"

dismiss_confirm { click_on "Delete Financial Account" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_financial_account_path(financial_account)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/financial_accounts/#{financial_account.id}"

accept_confirm { click_on "Delete Financial Account" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
FactoryBot.create(:financial_statement, financial_account: financial_account)
end

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/financial_accounts/#{financial_account.id}/financial_statements/#{financial_statement.id}"

dismiss_confirm { click_on "Delete Financial Statement" }
Expand All @@ -17,7 +17,7 @@
expect(page).to have_current_path crud_financial_account_financial_statement_path(financial_account, financial_statement)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/financial_accounts/#{financial_account.id}/financial_statements/#{financial_statement.id}"

accept_confirm { click_on "Delete Financial Statement" }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/gift_ideas/admin_deletes_gift_idea_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:gift_idea) { FactoryBot.create(:gift_idea) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/gift_ideas/#{gift_idea.id}"

dismiss_confirm { click_on "Delete Gift Idea" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_gift_idea_path(gift_idea)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/gift_ideas/#{gift_idea.id}"

accept_confirm { click_on "Delete Gift Idea" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:post_bin_request) { FactoryBot.create(:post_bin_request) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/post_bin_requests/#{post_bin_request.id}"

dismiss_confirm { click_on "Delete Post Bin Request" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_post_bin_request_path(post_bin_request)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/post_bin_requests/#{post_bin_request.id}"

accept_confirm { click_on "Delete Post Bin Request" }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/projects/admin_deletes_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:project) { FactoryBot.create(:project) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/projects/#{project.id}"

dismiss_confirm { click_on "Delete Project" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_project_path(project)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/projects/#{project.id}"

accept_confirm { click_on "Delete Project" }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/raw_hooks/admin_deletes_raw_hook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:raw_hook) { FactoryBot.create(:raw_hook) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/raw_hooks/#{raw_hook.id}"

dismiss_confirm { click_on "Delete Raw Hook" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_raw_hook_path(raw_hook)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/raw_hooks/#{raw_hook.id}"

accept_confirm { click_on "Delete Raw Hook" }
Expand Down
4 changes: 2 additions & 2 deletions spec/system/crud/sneakers/admin_deletes_sneaker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:sneaker) { FactoryBot.create(:sneaker) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/sneakers/#{sneaker.id}"

dismiss_confirm { click_on "Delete Sneaker" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_sneaker_path(sneaker)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/sneakers/#{sneaker.id}"

accept_confirm { click_on "Delete Sneaker" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:warm_fuzzy) { FactoryBot.create(:warm_fuzzy) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/warm_fuzzies/#{warm_fuzzy.id}"

dismiss_confirm { click_on "Delete Warm Fuzzy" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_warm_fuzzy_path(warm_fuzzy)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/warm_fuzzies/#{warm_fuzzy.id}"

accept_confirm { click_on "Delete Warm Fuzzy" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

let(:webhook_sender) { FactoryBot.create(:webhook_sender) }

scenario "cancels delete" do
scenario "cancels delete", js: true do
visit "/crud/webhook_senders/#{webhook_sender.id}"

dismiss_confirm { click_on "Delete Webhook Sender" }
Expand All @@ -14,7 +14,7 @@
expect(page).to have_current_path crud_webhook_sender_path(webhook_sender)
end

scenario "confirms delete" do
scenario "confirms delete", js: true do
visit "/crud/webhook_senders/#{webhook_sender.id}"

accept_confirm { click_on "Delete Webhook Sender" }
Expand Down

0 comments on commit d0a54f3

Please sign in to comment.