From 0a5246388f3147796f377edfb341625be391f2e4 Mon Sep 17 00:00:00 2001 From: James Mason Date: Mon, 19 Nov 2018 09:36:39 -0800 Subject: [PATCH] Adapt tests to new, pickier Capybara --- spec/features/resource_spec.rb | 4 +--- spec/features/roles_spec.rb | 2 +- spec/features/versions_spec.rb | 12 +++++------- spec/support/save_feature_failures.rb | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spec/features/resource_spec.rb b/spec/features/resource_spec.rb index c9a20667..127c8b18 100644 --- a/spec/features/resource_spec.rb +++ b/spec/features/resource_spec.rb @@ -29,10 +29,8 @@ feature Resource do scenario 'edit an existing resource' do visit admin_conference_resources_path(conference.short_title) - click_link('Edit', edit_admin_conference_resource_path(conference.short_title, resource.id)) - + click_link('Edit') fill_in 'resource_name', with: 'changed_name' - click_button 'Update Resource' resource.reload page.find('#flash') diff --git a/spec/features/roles_spec.rb b/spec/features/roles_spec.rb index 2cd6a265..723b41c0 100644 --- a/spec/features/roles_spec.rb +++ b/spec/features/roles_spec.rb @@ -69,7 +69,7 @@ feature Role do bootstrap_switch = first('td').find('.bootstrap-switch-container') bootstrap_switch.click - expect(find('.alert').text).to eq "× Successfully removed role #{role_name} from user #{user_with_role.email}" + expect(page).to have_css('.alert', text: "Successfully removed role #{role_name} from user #{user_with_role.email}") expect(by_role_name).to eq(role_name) | eq('organizer') user_with_role.reload expect(user_with_role.has_cached_role?(role_name, conference)).to eq false diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 1c796fdd..14b8154c 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -254,8 +254,7 @@ feature 'Version' do visit admin_revision_history_path expect(page).to have_text("#{organizer.name} created new splashpage with ID #{splashpage_id} in conference #{conference.short_title}") - expect(page).to have_text("#{organizer.name} updated public, include program, include cfp, include venue, include tickets, include lodgings, - include sponsors and include social media of splashpage with ID #{splashpage_id} in conference #{conference.short_title}") + expect(page).to have_text("#{organizer.name} updated public, include program, include cfp, include venue, include tickets, include lodgings, include sponsors and include social media of splashpage with ID #{splashpage_id} in conference #{conference.short_title}") expect(page).to have_text("#{organizer.name} deleted splashpage with ID #{splashpage_id} in conference #{conference.short_title}") end @@ -359,8 +358,7 @@ feature 'Version' do conference.email_settings.update_attributes(registration_subject: 'xxxxx', registration_body: 'yyyyy', accepted_subject: 'zzzzz') visit admin_revision_history_path - expect(page).to have_text("Someone (probably via the console) updated registration body, registration subject and accepted subject - of email settings in conference #{conference.short_title}") + expect(page).to have_text("Someone (probably via the console) updated registration body, registration subject and accepted subject of email settings in conference #{conference.short_title}") end scenario 'display changes in conference registrations', feature: true, versioning: true, js: true do @@ -402,7 +400,7 @@ feature 'Version' do visit admin_revision_history_path expect(page).to have_text("#{organizer.name} commented on event My second event in conference #{conference.short_title}") expect(page).to have_text("Someone (probably via the console) deleted #{organizer.name}'s comment on event #{event.title} in conference #{conference.short_title}") - expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s comment on event #{event.title} in conference #{conference.short_title}") + expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s comment on event #{event.title} in conference #{conference.short_title}") end scenario 'display changes in vote', feature: true, versioning: true, js: true do @@ -416,7 +414,7 @@ feature 'Version' do visit admin_revision_history_path expect(page).to have_text("Someone (probably via the console) voted on event My second event in conference #{conference.short_title}") expect(page).to have_text("Someone (probably via the console) deleted #{organizer.name}'s vote on event #{event.title} in conference #{conference.short_title}") - expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s vote on event #{event.title} in conference #{conference.short_title}") + expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s vote on event #{event.title} in conference #{conference.short_title}") end scenario 'display password reset requests', feature: true, versioning: true, js: true do @@ -439,6 +437,6 @@ feature 'Version' do user.update_attributes(nickname: 'testnick', affiliation: 'openSUSE') visit admin_revision_history_path - expect(page).to have_text("Someone (probably via the console) updated nickname and affiliation of user #{user.name}") + expect(page).to have_text("Someone (probably via the console) updated nickname and affiliation of user #{user.name}") end end diff --git a/spec/support/save_feature_failures.rb b/spec/support/save_feature_failures.rb index 0cdaf07f..698e8894 100644 --- a/spec/support/save_feature_failures.rb +++ b/spec/support/save_feature_failures.rb @@ -5,7 +5,7 @@ RSpec.configure do |config| example_filename = RSpec.current_example.full_description example_filename = example_filename.tr(' ', '_') example_filename += '.html' - example_filename = File.expand_path(example_filename, Capybara.save_and_open_page_path) + example_filename = File.expand_path(example_filename, Capybara.save_path) if RSpec.current_example.exception.present? save_page(example_filename) # remove the file if the test starts working again