Adapt tests to new, pickier Capybara

This commit is contained in:
James Mason 2018-11-19 09:36:39 -08:00
parent 287344e816
commit 0a5246388f
4 changed files with 8 additions and 12 deletions

View file

@ -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')

View file

@ -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

View file

@ -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

View file

@ -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