Fix up test failures in Chrome & Firefox

This commit is contained in:
James Mason 2018-10-25 16:16:56 -07:00
parent b72bb8a0ed
commit 1b9a12746d
29 changed files with 145 additions and 78 deletions

View file

@ -18,6 +18,7 @@ feature Conference do
click_button 'Create Cfp' click_button 'Create Cfp'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Creating the call for papers failed. ' + .to eq('Creating the call for papers failed. ' +
"Start date can't be blank. End date can't be blank.") "Start date can't be blank. End date can't be blank.")
@ -53,6 +54,7 @@ feature Conference do
page.execute_script( page.execute_script(
"$('#registration-period-start-datepicker').val('')") "$('#registration-period-start-datepicker').val('')")
click_button 'Update Cfp' click_button 'Update Cfp'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Updating call for papers failed. ' + .to eq('Updating call for papers failed. ' +
"Start date can't be blank.") "Start date can't be blank.")
@ -67,6 +69,7 @@ feature Conference do
click_button 'Update Cfp' click_button 'Update Cfp'
# Validations # Validations
page.find('#flash')
expect(flash) expect(flash)
.to eq('Call for papers successfully updated.') .to eq('Call for papers successfully updated.')

View file

@ -68,25 +68,33 @@ feature 'Code of Conduct:' do
let!(:organization) { create(:organization, code_of_conduct: sample_text) } let!(:organization) { create(:organization, code_of_conduct: sample_text) }
let!(:participant) { create(:user) } let!(:participant) { create(:user) }
before { sign_in participant } before do
sign_in participant
it 'must be accepted', js: true do
visit conferences_path visit conferences_path
within "#conference-#{conference.id}" do within "#conference-#{conference.id}" do
click_on 'Register' click_on 'Register'
end end
end
it 'can be viewed', js: true do
page.find('input#registration_accepted_code_of_conduct')
expect(page).to have_text('I have read and accept the Code of Conduct') expect(page).to have_text('I have read and accept the Code of Conduct')
expect(page).not_to have_text(sample_text) expect(page).not_to have_text(sample_text)
within 'form' do within 'form' do
click_on 'Code of Conduct' click_on 'Code of Conduct'
end end
page.find('.modal-dialog')
expect(page).to have_content(sample_text) expect(page).to have_content(sample_text)
find('button.close').click end
click_on 'Register'
it 'must be accepted', js: true do
find("input[type='submit']").click
page.find('#flash')
expect(conference.user_registered?(participant)).to be_falsey expect(conference.user_registered?(participant)).to be_falsey
expect(page).to have_content('Accepted code of conduct must be accepted') expect(flash).to match('Accepted code of conduct must be accepted')
check 'registration[accepted_code_of_conduct]' check 'registration[accepted_code_of_conduct]'
click_on 'Register' click_on 'Register'
page.find('#flash')
expect(conference.user_registered?(participant)).to be_truthy expect(conference.user_registered?(participant)).to be_truthy
visit conference_conference_registration_path(conference) visit conference_conference_registration_path(conference)
expect(page).to have_content('You have accepted the Code of Conduct') expect(page).to have_content('You have accepted the Code of Conduct')

View file

@ -15,27 +15,30 @@ feature Commercial do
visit admin_conference_commercials_path(conference.short_title) visit admin_conference_commercials_path(conference.short_title)
# Workaround to enable the 'Create Commercial' button
page.execute_script("$('#commercial_submit_action').prop('disabled', false)")
# Create valid commercial # Create valid commercial
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Create Commercial' click_button 'Create Commercial'
page.find('#flash')
expect(flash).to eq('Commercial was successfully created.') expect(flash).to eq('Commercial was successfully created.')
page.find('#flash .button.close').click
expect(conference.commercials.count).to eq(1) expect(conference.commercials.count).to eq(1)
commercial = conference.commercials.where(url: 'https://www.youtube.com/watch?v=M9bq_alk-sw').first commercial = conference.commercials.where(url: 'https://www.youtube.com/watch?v=M9bq_alk-sw').first
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=VNkDJk5_9eU' fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=VNkDJk5_9eU'
click_button 'Update' click_button 'Update'
page.find('#flash')
expect(flash).to eq('Commercial was successfully updated.') expect(flash).to eq('Commercial was successfully updated.')
page.find('#flash .button.close').click
expect(conference.commercials.count).to eq(1) expect(conference.commercials.count).to eq(1)
commercial.reload commercial.reload
expect(commercial.url).to eq 'https://www.youtube.com/watch?v=VNkDJk5_9eU' expect(commercial.url).to eq 'https://www.youtube.com/watch?v=VNkDJk5_9eU'
# Delete commercial # Delete commercial
click_link 'Delete' page.accept_alert do
click_link 'Delete'
end
page.find('#flash')
expect(flash).to eq('Commercial was successfully destroyed.') expect(flash).to eq('Commercial was successfully destroyed.')
expect(conference.commercials.count).to eq(0) expect(conference.commercials.count).to eq(0)
end end
@ -65,6 +68,7 @@ feature Commercial do
page.execute_script("$('#commercial_submit_action').prop('disabled', false)") page.execute_script("$('#commercial_submit_action').prop('disabled', false)")
click_button 'Create Commercial' click_button 'Create Commercial'
page.find('#flash')
expect(flash).to eq('Commercial was successfully created.') expect(flash).to eq('Commercial was successfully created.')
expect(event.commercials.count).to eq(1) expect(event.commercials.count).to eq(1)
end end
@ -73,14 +77,8 @@ feature Commercial do
visit edit_conference_program_proposal_path(conference.short_title, event.id) visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials' click_link 'Commercials'
fill_in 'commercial_url', with: 'invalid_commercial_url' fill_in 'commercial_url', with: 'invalid_commercial_url'
expect(page).to have_content('No embeddable content')
# Workaround to enable the 'Create Commercial' button expect(page).to have_css("button[type='submit']:disabled", text: 'Create Commercial')
page.execute_script("$('#commercial_submit_action').prop('disabled', false)")
click_button 'Create Commercial'
expect(flash).to include('An error prohibited this Commercial from being saved:')
expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id)
expect(event.commercials.count).to eq(0)
end end
scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do
@ -91,13 +89,14 @@ feature Commercial do
click_link 'Commercials' click_link 'Commercials'
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update' click_button 'Update'
page.find('#flash')
expect(flash).to eq('Commercial was successfully updated.') expect(flash).to eq('Commercial was successfully updated.')
expect(event.commercials.count).to eq(1) expect(event.commercials.count).to eq(1)
commercial.reload commercial.reload
expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw') expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw')
end end
scenario 'does not update a commercial of an event with invalid data', feature: true, versioning: true, js: true do scenario 'does not update a commercial of an event with invalid data', feature: true, versioning: true do
commercial = create(:commercial, commercial = create(:commercial,
commercialable_id: event.id, commercialable_id: event.id,
commercialable_type: 'Event', commercialable_type: 'Event',
@ -106,8 +105,9 @@ feature Commercial do
click_link 'Commercials' click_link 'Commercials'
fill_in "commercial_url_#{commercial.id}", with: 'invalid_commercial_url' fill_in "commercial_url_#{commercial.id}", with: 'invalid_commercial_url'
click_button 'Update' click_button 'Update'
expect(flash).to include('An error prohibited this Commercial from being saved:') find('#flash')
expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id) expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id)
expect(flash).to include('An error prohibited this Commercial from being saved:')
commercial.reload commercial.reload
expect(commercial.url).to eq('https://www.youtube.com/watch?v=BTTygyxuGj8') expect(commercial.url).to eq('https://www.youtube.com/watch?v=BTTygyxuGj8')
end end
@ -118,8 +118,10 @@ feature Commercial do
commercialable_type: 'Event') commercialable_type: 'Event')
visit edit_conference_program_proposal_path(conference.short_title, event.id) visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials' click_link 'Commercials'
click_link 'Delete' page.accept_alert do
page.driver.network_traffic click_link 'Delete'
end
page.find('#flash')
expect(flash).to eq('Commercial was successfully destroyed.') expect(flash).to eq('Commercial was successfully destroyed.')
expect(event.commercials.count).to eq(0) expect(event.commercials.count).to eq(0)
end end

View file

@ -35,7 +35,11 @@ feature Registration do
click_link 'My Registration' click_link 'My Registration'
expect(current_path).to eq(conference_conference_registration_path(conference.short_title)) expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
click_link 'Unregister' page.accept_alert do
click_link 'Unregister'
end
page.find('#flash')
expect(page).to have_content('not registered')
expect(conference.user_registered?(participant)).to be(false) expect(conference.user_registered?(participant)).to be(false)
end end
end end

View file

@ -28,6 +28,7 @@ feature Conference do
click_button 'Create Conference' click_button 'Create Conference'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Conference was successfully created.') .to eq('Conference was successfully created.')
expect(Conference.count).to eq(expected_count) expect(Conference.count).to eq(expected_count)
@ -49,9 +50,14 @@ feature Conference do
fill_in 'conference_title', with: 'New Con' fill_in 'conference_title', with: 'New Con'
fill_in 'conference_short_title', with: '' fill_in 'conference_short_title', with: ''
click_button 'Update Conference' page.accept_alert do
click_button 'Update Conference'
end
page.find('#flash')
expect(flash) expect(flash)
.to eq("Updating conference failed. Short title can't be blank.") .to eq("Updating conference failed. Short title can't be blank.")
page.find('#flash .close').click
fill_in 'conference_title', with: 'New Con' fill_in 'conference_title', with: 'New Con'
fill_in 'conference_short_title', with: 'NewCon' fill_in 'conference_short_title', with: 'NewCon'
@ -64,9 +70,12 @@ feature Conference do
.execute_script("$('#conference-end-datepicker').val('" + .execute_script("$('#conference-end-datepicker').val('" +
"#{(day + 7).strftime('%d/%m/%Y')}')") "#{(day + 7).strftime('%d/%m/%Y')}')")
click_button 'Update Conference' page.accept_alert do
expect(flash) click_button 'Update Conference'
.to eq('Conference was successfully updated.') end
page.find('#flash')
expect(flash).to eq('Conference was successfully updated.')
conference.reload conference.reload
expect(conference.title).to eq('New Con') expect(conference.title).to eq('New Con')

View file

@ -16,7 +16,7 @@ feature Contact do
visit edit_admin_conference_contact_path(conference.short_title) visit edit_admin_conference_contact_path(conference.short_title)
fill_in 'contact_' + field_name, with: field_value fill_in 'contact_' + field_name, with: field_value
click_button 'Update Contact' click_button 'Update Contact'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Contact details were successfully updated.') .to eq('Contact details were successfully updated.')
contact.reload contact.reload

View file

@ -22,7 +22,7 @@ feature DifficultyLevel do
page.find('#difficulty_level_color').set('#ff0000') page.find('#difficulty_level_color').set('#ff0000')
click_button 'Create Difficulty level' click_button 'Create Difficulty level'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Difficulty level successfully created.') expect(flash).to eq('Difficulty level successfully created.')
within('table#difficulty_levels') do within('table#difficulty_levels') do
@ -40,9 +40,12 @@ feature DifficultyLevel do
conference_id: conference.short_title) conference_id: conference.short_title)
# Remove difficulty level # Remove difficulty level
within('table tr:nth-of-type(4)') do page.accept_alert do
click_link 'Delete' within('table tr:nth-of-type(4)') do
click_link 'Delete'
end
end end
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Difficulty level successfully deleted.') expect(flash).to eq('Difficulty level successfully deleted.')

View file

@ -37,6 +37,7 @@ feature EmailSettings do
fill_in 'email_settings_confirmed_without_registration_body', fill_in 'email_settings_confirmed_without_registration_body',
with: 'Confirmed without registration email body' with: 'Confirmed without registration email body'
page.execute_script 'window.scrollTo(0,0)'
click_link 'Update Notifications' click_link 'Update Notifications'
fill_in 'email_settings_conference_dates_updated_subject', fill_in 'email_settings_conference_dates_updated_subject',
with: 'Updated conference dates subject' with: 'Updated conference dates subject'
@ -54,7 +55,7 @@ feature EmailSettings do
with: 'Updated conference venue template' with: 'Updated conference venue template'
click_button 'Update Email settings' click_button 'Update Email settings'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Email settings have been successfully updated.') .to eq('Email settings have been successfully updated.')

View file

@ -28,7 +28,7 @@ feature EventType do
page.find('#event_type_color').set('#e4e4e4') page.find('#event_type_color').set('#e4e4e4')
click_button 'Create Event type' click_button 'Create Event type'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Event type successfully created.') expect(flash).to eq('Event type successfully created.')
within('table#event_types') do within('table#event_types') do
@ -42,6 +42,7 @@ feature EventType do
within('tr', text: 'Party') do within('tr', text: 'Party') do
click_link 'Delete' click_link 'Delete'
end end
page.find('#flash')
expect(flash).to eq('Event type successfully deleted.') expect(flash).to eq('Event type successfully deleted.')
within('table#event_types') do within('table#event_types') do

View file

@ -21,7 +21,7 @@ feature Lodging do
attach_file 'Picture', path attach_file 'Picture', path
click_button 'Create Lodging' click_button 'Create Lodging'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Lodging successfully created.') expect(flash).to eq('Lodging successfully created.')
expect(page.has_content?('New lodging')).to be true expect(page.has_content?('New lodging')).to be true
@ -47,7 +47,7 @@ feature Lodging do
attach_file 'Picture', path attach_file 'Picture', path
click_button 'Update Lodging' click_button 'Update Lodging'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Lodging successfully updated.') expect(flash).to eq('Lodging successfully updated.')
expect(page.has_content?('New lodging')).to be true expect(page.has_content?('New lodging')).to be true
@ -67,9 +67,10 @@ feature Lodging do
expect(page.has_content?(lodging.name)).to be true expect(page.has_content?(lodging.name)).to be true
# Add lodging page.accept_alert do
click_link 'Delete' click_link 'Delete'
end
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Lodging successfully deleted.') expect(flash).to eq('Lodging successfully deleted.')
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be false expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be false

View file

@ -20,6 +20,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('test-1@example.com signed in successfully with google') expect(flash).to eq('test-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
@ -35,6 +36,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google') expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
@ -47,7 +49,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('Could not authenticate you from Google because "Invalid credentials".') expect(flash).to eq('Could not authenticate you from Google because "Invalid credentials".')
end end
@ -65,6 +67,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google') expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
@ -82,7 +85,9 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google') expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
page.find('#flash .close').click
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
@ -95,7 +100,9 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-google' click_link 'omniauth-google'
end end
page.find('#flash')
expect(flash).to eq('test-participant-1@example.com signed in successfully with google') expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
page.find('#flash .close').click
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
expect(Openid.where(email: 'test-participant-1@example.com').first.nil?).to eq(false) expect(Openid.where(email: 'test-participant-1@example.com').first.nil?).to eq(false)
@ -111,6 +118,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link 'omniauth-facebook' click_link 'omniauth-facebook'
end end
page.find('#flash')
expect(flash).to eq('test-participant-1@example.com signed in successfully with facebook') expect(flash).to eq('test-participant-1@example.com signed in successfully with facebook')
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)
@ -136,6 +144,7 @@ feature Openid do
within('#openidlinks') do within('#openidlinks') do
click_link "omniauth-#{provider}" click_link "omniauth-#{provider}"
end end
page.find('#flash')
expect(flash).to eq("user-#{provider}@example.com signed in successfully with #{provider}") expect(flash).to eq("user-#{provider}@example.com signed in successfully with #{provider}")
expect(Openid.count).to eq(expected_count_openid) expect(Openid.count).to eq(expected_count_openid)
expect(User.count).to eq(expected_count_user) expect(User.count).to eq(expected_count_user)

View file

@ -16,6 +16,7 @@ feature Organization do
click_button 'Update Organization' click_button 'Update Organization'
organization.reload organization.reload
page.find('#flash')
expect(flash).to eq('Organization successfully updated') expect(flash).to eq('Organization successfully updated')
expect(organization.name).to eq('changed name') expect(organization.name).to eq('changed name')
end end
@ -30,7 +31,7 @@ feature Organization do
fill_in 'organization_name', with: 'Organization name' fill_in 'organization_name', with: 'Organization name'
click_button 'Create Organization' click_button 'Create Organization'
page.find('#flash')
expect(flash).to eq('Organization successfully created') expect(flash).to eq('Organization successfully created')
expect(Organization.last.name).to eq('Organization name') expect(Organization.last.name).to eq('Organization name')
end end
@ -44,7 +45,7 @@ feature Organization do
end end
scenario "can't create new organization", feature: true, js: true do scenario "can't create new organization", feature: true, js: true do
visit new_admin_organization_path visit new_admin_organization_path
page.find('#flash')
expect(flash).to eq('You are not authorized to access this page.') expect(flash).to eq('You are not authorized to access this page.')
end end

View file

@ -22,7 +22,7 @@ feature Program do
fill_in 'program_rating', with: '4' fill_in 'program_rating', with: '4'
click_button 'Update Program' click_button 'Update Program'
page.find('#flash')
# Validations # Validations
expect(flash) expect(flash)
.to eq('The program was successfully updated.') .to eq('The program was successfully updated.')

View file

@ -85,6 +85,7 @@ feature Event do
fill_in 'event_abstract', with: 'Lorem ipsum abstract' fill_in 'event_abstract', with: 'Lorem ipsum abstract'
click_button 'Create Proposal' click_button 'Create Proposal'
page.find('#flash')
expect(page).to have_content 'Proposal was successfully submitted.' expect(page).to have_content 'Proposal was successfully submitted.'
expect(Event.count).to eq(expected_count_event) expect(Event.count).to eq(expected_count_event)
@ -103,6 +104,7 @@ feature Event do
select('Easy', from: 'event[difficulty_level_id]') select('Easy', from: 'event[difficulty_level_id]')
click_button 'Update Proposal' click_button 'Update Proposal'
page.find('#flash')
expect(page).to have_content 'Proposal was successfully updated.' expect(page).to have_content 'Proposal was successfully updated.'
end end
@ -121,6 +123,7 @@ feature Event do
fill_in 'event_description', with: 'Lorem ipsum description' fill_in 'event_description', with: 'Lorem ipsum description'
click_button 'Create Proposal' click_button 'Create Proposal'
page.find('#flash')
expect(page).to have_content 'Proposal was successfully submitted.' expect(page).to have_content 'Proposal was successfully submitted.'
expect(current_path).to eq(conference_program_proposals_path(conference.short_title)) expect(current_path).to eq(conference_program_proposals_path(conference.short_title))
@ -145,6 +148,8 @@ feature Event do
visit conference_program_proposals_path(conference.short_title) visit conference_program_proposals_path(conference.short_title)
expect(page).to have_content 'Example Proposal' expect(page).to have_content 'Example Proposal'
click_link "delete_proposal_#{@event.id}" click_link "delete_proposal_#{@event.id}"
page.accept_alert
page.find('#flash')
expect(page).to have_content 'Proposal was successfully withdrawn.' expect(page).to have_content 'Proposal was successfully withdrawn.'
@event.reload @event.reload
expect(@event.state).to eq('withdrawn') expect(@event.state).to eq('withdrawn')

View file

@ -19,10 +19,11 @@ feature RegistrationPeriod do
click_link 'New Registration Period' click_link 'New Registration Period'
click_button 'Save Registration Period' click_button 'Save Registration Period'
page.find('#flash')
expect(flash) expect(flash)
.to eq('An error prohibited the Registration Period from being saved: ' \ .to eq('An error prohibited the Registration Period from being saved: ' \
"Start date can't be blank. End date can't be blank.") "Start date can't be blank. End date can't be blank.")
page.find('#flash .close').click
page page
.execute_script("$('#registration-period-start-datepicker').val('" + .execute_script("$('#registration-period-start-datepicker').val('" +
"#{Date.today.strftime('%d/%m/%Y')}')") "#{Date.today.strftime('%d/%m/%Y')}')")
@ -31,7 +32,7 @@ feature RegistrationPeriod do
"#{(Date.today + 5).strftime('%d/%m/%Y')}')") "#{(Date.today + 5).strftime('%d/%m/%Y')}')")
click_button 'Save Registration Period' click_button 'Save Registration Period'
page.find('#flash')
expect(flash).to eq('Registration Period successfully updated.') expect(flash).to eq('Registration Period successfully updated.')
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title)) expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))

View file

@ -23,6 +23,7 @@ feature Resource do
click_button 'Create Resource' click_button 'Create Resource'
expect(Resource.count).to eq(2) expect(Resource.count).to eq(2)
page.find('#flash')
expect(flash).to eq('Resource successfully created.') expect(flash).to eq('Resource successfully created.')
end end
@ -34,7 +35,7 @@ feature Resource do
click_button 'Update Resource' click_button 'Update Resource'
resource.reload resource.reload
page.find('#flash')
expect(flash).to eq('Resource successfully updated.') expect(flash).to eq('Resource successfully updated.')
expect(resource.name).to eq('changed_name') expect(resource.name).to eq('changed_name')
end end
@ -43,6 +44,7 @@ feature Resource do
visit admin_conference_resources_path(conference.short_title) visit admin_conference_resources_path(conference.short_title)
click_link('Delete', href: admin_conference_resource_path(conference.short_title, resource.id)) click_link('Delete', href: admin_conference_resource_path(conference.short_title, resource.id))
page.find('#flash')
expect(flash).to eq('Resource successfully destroyed.') expect(flash).to eq('Resource successfully destroyed.')
end end
end end

View file

@ -21,7 +21,7 @@ feature Role do
fill_in 'role_description', with: 'changed description' fill_in 'role_description', with: 'changed description'
click_button 'Update Role' click_button 'Update Role'
role.reload role.reload
page.find('#flash')
expect(flash).to eq("Successfully updated role #{role_name}") expect(flash).to eq("Successfully updated role #{role_name}")
expect(role.description).to eq('changed description') expect(role.description).to eq('changed description')
end end
@ -69,7 +69,7 @@ feature Role do
bootstrap_switch = first('td').find('.bootstrap-switch-container') bootstrap_switch = first('td').find('.bootstrap-switch-container')
bootstrap_switch.click bootstrap_switch.click
expect(find('.alert').text).to eq "×Successfully removed role #{role_name} from user #{user_with_role.email}" expect(find('.alert').text).to eq "× Successfully removed role #{role_name} from user #{user_with_role.email}"
expect(by_role_name).to eq(role_name) | eq('organizer') expect(by_role_name).to eq(role_name) | eq('organizer')
user_with_role.reload user_with_role.reload
expect(user_with_role.has_cached_role?(role_name, conference)).to eq false expect(user_with_role.has_cached_role?(role_name, conference)).to eq false

View file

@ -23,7 +23,7 @@ feature Room do
fill_in 'room_size', with: '100' fill_in 'room_size', with: '100'
click_button 'Create Room' click_button 'Create Room'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Room successfully created.') expect(flash).to eq('Room successfully created.')
within('table#rooms') do within('table#rooms') do
@ -42,7 +42,7 @@ feature Room do
fill_in 'room_size', with: '100' fill_in 'room_size', with: '100'
click_button 'Update Room' click_button 'Update Room'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Room successfully updated.') expect(flash).to eq('Room successfully updated.')
within('table#rooms') do within('table#rooms') do

View file

@ -16,7 +16,7 @@ feature Splashpage do
click_link 'Create Splashpage' click_link 'Create Splashpage'
click_button 'Save Changes' click_button 'Save Changes'
page.find('#flash')
expect(flash).to eq('Splashpage successfully created.') expect(flash).to eq('Splashpage successfully created.')
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
expect(page.has_text?('Private')).to be true expect(page.has_text?('Private')).to be true
@ -32,7 +32,7 @@ feature Splashpage do
click_link 'Edit' click_link 'Edit'
check('Make splash page public') check('Make splash page public')
click_button 'Save Changes' click_button 'Save Changes'
page.find('#flash')
expect(flash).to eq('Splashpage successfully updated.') expect(flash).to eq('Splashpage successfully updated.')
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
expect(page.has_text?('Public')).to be true expect(page.has_text?('Public')).to be true
@ -45,7 +45,8 @@ feature Splashpage do
sign_in organizer sign_in organizer
visit admin_conference_splashpage_path(conference.short_title) visit admin_conference_splashpage_path(conference.short_title)
click_link 'Delete' click_link 'Delete'
page.accept_alert
page.find('#flash')
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title)) expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
expect(flash).to eq('Splashpage was successfully destroyed.') expect(flash).to eq('Splashpage was successfully destroyed.')
expect(Splashpage.count).to eq(0) expect(Splashpage.count).to eq(0)
@ -60,7 +61,7 @@ feature Splashpage do
scenario 'splashpage is not accessible for participants if it is not public' do scenario 'splashpage is not accessible for participants if it is not public' do
sign_in participant sign_in participant
visit conference_path(conference.short_title) visit conference_path(conference.short_title)
page.find('#flash')
expect(flash).to eq('You are not authorized to access this page.') expect(flash).to eq('You are not authorized to access this page.')
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
end end

View file

@ -26,7 +26,7 @@ feature Sponsor do
select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id') select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id')
click_button 'Create Sponsor' click_button 'Create Sponsor'
page.find('#flash')
expect(flash).to eq('Sponsor successfully created.') expect(flash).to eq('Sponsor successfully created.')
within('table#sponsors') do within('table#sponsors') do
expect(page.has_content?('SUSE')).to be true expect(page.has_content?('SUSE')).to be true
@ -46,6 +46,7 @@ feature Sponsor do
click_link 'Delete' click_link 'Delete'
end end
end end
page.find('#flash')
expect(flash).to eq('Sponsor successfully deleted.') expect(flash).to eq('Sponsor successfully deleted.')
expect(page).to_not have_selector('table#sponsors') expect(page).to_not have_selector('table#sponsors')
end end

View file

@ -21,7 +21,7 @@ feature SponsorshipLevel do
fill_in 'sponsorship_level_title', with: 'Platin' fill_in 'sponsorship_level_title', with: 'Platin'
click_button 'Create Sponsorship level' click_button 'Create Sponsorship level'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Sponsorship level successfully created.') expect(flash).to eq('Sponsorship level successfully created.')
within('table#sponsorship_levels') do within('table#sponsorship_levels') do
@ -39,7 +39,7 @@ feature SponsorshipLevel do
fill_in 'sponsorship_level_title', with: 'Gold' fill_in 'sponsorship_level_title', with: 'Gold'
click_button 'Update Sponsorship level' click_button 'Update Sponsorship level'
page.find('#flash')
# Validations # Validations
expect(flash).to eq('Sponsorship level successfully updated.') expect(flash).to eq('Sponsorship level successfully updated.')
within('table#sponsorship_levels') do within('table#sponsorship_levels') do

View file

@ -32,7 +32,7 @@ feature Registration do
expect(current_path).to eq(conference_tickets_path(conference.short_title)) expect(current_path).to eq(conference_tickets_path(conference.short_title))
click_button 'Continue' click_button 'Continue'
page.find('#flash')
expect(current_path).to eq(new_conference_payment_path(conference.short_title)) expect(current_path).to eq(new_conference_payment_path(conference.short_title))
expect(flash).to eq('Please pay here to get tickets.') expect(flash).to eq('Please pay here to get tickets.')
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
@ -68,7 +68,7 @@ feature Registration do
expect(current_path).to eq(conference_tickets_path(conference.short_title)) expect(current_path).to eq(conference_tickets_path(conference.short_title))
click_button 'Continue' click_button 'Continue'
page.find('#flash')
expect(current_path).to eq(new_conference_payment_path(conference.short_title)) expect(current_path).to eq(new_conference_payment_path(conference.short_title))
expect(flash).to eq('Please pay here to get tickets.') expect(flash).to eq('Please pay here to get tickets.')
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
@ -87,7 +87,7 @@ feature Registration do
page.execute_script(%{ $('#submitButton').click(); }) page.execute_script(%{ $('#submitButton').click(); })
sleep(20) sleep(20)
end end
page.find('#flash')
expect(current_path).to eq(conference_payments_path(conference.short_title)) expect(current_path).to eq(conference_payments_path(conference.short_title))
expect(flash).to eq('Your card was declined. Please try again with correct credentials.') expect(flash).to eq('Your card was declined. Please try again with correct credentials.')
end end
@ -138,7 +138,7 @@ feature Registration do
expect(current_path).to eq(conference_tickets_path(conference.short_title)) expect(current_path).to eq(conference_tickets_path(conference.short_title))
click_button 'Continue' click_button 'Continue'
page.find('#flash')
expect(flash).to eq('Oops, something went wrong with your purchase! You cannot buy more than one registration tickets.') expect(flash).to eq('Oops, something went wrong with your purchase! You cannot buy more than one registration tickets.')
expect(current_path).to eq(conference_tickets_path(conference.short_title)) expect(current_path).to eq(conference_tickets_path(conference.short_title))
end end
@ -157,7 +157,7 @@ feature Registration do
expect(current_path).to eq(conference_tickets_path(conference.short_title)) expect(current_path).to eq(conference_tickets_path(conference.short_title))
click_button 'Continue' click_button 'Continue'
page.find('#flash')
expect(current_path).to eq(new_conference_payment_path(conference.short_title)) expect(current_path).to eq(new_conference_payment_path(conference.short_title))
expect(flash).to eq('Please pay here to get tickets.') expect(flash).to eq('Please pay here to get tickets.')
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first

View file

@ -25,6 +25,7 @@ feature Ticket do
fill_in 'ticket_price', with: '100' fill_in 'ticket_price', with: '100'
click_button 'Create Ticket' click_button 'Create Ticket'
page.find('#flash')
expect(flash).to eq('Ticket successfully created.') expect(flash).to eq('Ticket successfully created.')
expect(Ticket.count).to eq(2) expect(Ticket.count).to eq(2)
end end
@ -37,6 +38,7 @@ feature Ticket do
fill_in 'ticket_price', with: '-1' fill_in 'ticket_price', with: '-1'
click_button 'Create Ticket' click_button 'Create Ticket'
page.find('#flash')
expect(flash).to eq("Creating Ticket failed: Title can't be blank. Price cents must be greater than or equal to 0.") expect(flash).to eq("Creating Ticket failed: Title can't be blank. Price cents must be greater than or equal to 0.")
expect(Ticket.count).to eq(1) expect(Ticket.count).to eq(1)
end end
@ -55,9 +57,10 @@ feature Ticket do
ticket.reload ticket.reload
# It's necessary to multiply by 100 because the price is in cents # It's necessary to multiply by 100 because the price is in cents
page.find('#flash')
expect(flash).to eq('Ticket successfully updated.')
expect(ticket.price).to eq(Money.new(50 * 100, 'USD')) expect(ticket.price).to eq(Money.new(50 * 100, 'USD'))
expect(ticket.title).to eq('Event Ticket') expect(ticket.title).to eq('Event Ticket')
expect(flash).to eq('Ticket successfully updated.')
expect(Ticket.count).to eq(2) expect(Ticket.count).to eq(2)
end end
@ -72,6 +75,7 @@ feature Ticket do
ticket.reload ticket.reload
# It's necessary to multiply by 100 because the price is in cents # It's necessary to multiply by 100 because the price is in cents
page.find('#flash')
expect(ticket.price).to eq(Money.new(100 * 100, 'USD')) expect(ticket.price).to eq(Money.new(100 * 100, 'USD'))
expect(ticket.title).to eq('Business Ticket') expect(ticket.title).to eq('Business Ticket')
expect(flash).to eq("Ticket update failed: Title can't be blank. Price cents must be greater than or equal to 0.") expect(flash).to eq("Ticket update failed: Title can't be blank. Price cents must be greater than or equal to 0.")
@ -81,7 +85,8 @@ feature Ticket do
scenario 'delete ticket', feature: true, js: true do scenario 'delete ticket', feature: true, js: true do
visit admin_conference_tickets_path(conference.short_title) visit admin_conference_tickets_path(conference.short_title)
click_link('Delete', href: admin_conference_ticket_path(conference.short_title, ticket.id)) click_link('Delete', href: admin_conference_ticket_path(conference.short_title, ticket.id))
page.accept_alert
page.find('#flash')
expect(flash).to eq('Ticket successfully destroyed.') expect(flash).to eq('Ticket successfully destroyed.')
expect(Ticket.count).to eq(1) expect(Ticket.count).to eq(1)
end end

View file

@ -22,6 +22,7 @@ feature Track do
page.find('#track_color').set('#B94D4D') page.find('#track_color').set('#B94D4D')
fill_in 'track_description', with: 'Events about our Linux distribution' fill_in 'track_description', with: 'Events about our Linux distribution'
click_button 'Create Track' click_button 'Create Track'
page.find('#flash')
end end
expected.to change { Track.count }.by 1 expected.to change { Track.count }.by 1
@ -36,20 +37,17 @@ feature Track do
track = create(:track, program_id: conference.program.id) track = create(:track, program_id: conference.program.id)
sign_in organizer sign_in organizer
expected = expect do visit admin_conference_program_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title) within('#tracks', visible: true) do
within('#tracks', visible: true) do click_link 'Delete'
page.accept_confirm do
find_link('Delete').click
end
end
end end
page.accept_alert
expected.to change { Track.count }.by(-1) page.find('#flash')
expect(flash).to eq('Track successfully deleted.') expect(flash).to eq('Track successfully deleted.')
expect(page.has_css?('table#tracks')).to be false expect(page.has_css?('table#tracks')).to be false
expect(page.has_content?(track.name)).to be false expect(page.has_content?(track.name)).to be false
expect(page.has_content?(track.description)).to be false expect(page.has_content?(track.description)).to be false
expect(Track.count).to eq(0)
end end
scenario 'updates a track', feature: true, js: true do scenario 'updates a track', feature: true, js: true do
@ -59,7 +57,7 @@ feature Track do
expected = expect do expected = expect do
visit admin_conference_program_tracks_path(conference_id: conference.short_title) visit admin_conference_program_tracks_path(conference_id: conference.short_title)
within('#tracks', visible: true) do within('#tracks', visible: true) do
find_link('Edit').trigger('click') click_link 'Edit'
end end
fill_in 'track_name', with: 'Distribution' fill_in 'track_name', with: 'Distribution'
@ -67,8 +65,8 @@ feature Track do
page.find('#track_color').set('#B94D4D') page.find('#track_color').set('#B94D4D')
fill_in 'track_description', with: 'Events about our Linux distribution' fill_in 'track_description', with: 'Events about our Linux distribution'
click_button 'Update Track' click_button 'Update Track'
page.find('#flash')
end end
expected.to_not(change { Track.count }) expected.to_not(change { Track.count })
expect(flash).to eq('Track successfully updated.') expect(flash).to eq('Track successfully updated.')
within('table#tracks') do within('table#tracks') do
@ -93,6 +91,7 @@ feature Track do
fill_in 'track_description', with: 'Events about our Linux distribution' fill_in 'track_description', with: 'Events about our Linux distribution'
fill_in 'track_relevance', with: 'Maintainer of super awesome distribution' fill_in 'track_relevance', with: 'Maintainer of super awesome distribution'
click_button 'Create Track' click_button 'Create Track'
page.find('#flash')
end end
expected.to change { Track.count }.by 1 expected.to change { Track.count }.by 1
@ -113,6 +112,7 @@ feature Track do
accept_confirm do accept_confirm do
click_link 'Withdraw' click_link 'Withdraw'
end end
page.find('#flash')
end end
expected.to_not(change { Track.count }) expected.to_not(change { Track.count })
@ -136,6 +136,7 @@ feature Track do
page.find('#track_color').set('#B94D4D') page.find('#track_color').set('#B94D4D')
fill_in 'track_description', with: 'Events about our Linux distribution' fill_in 'track_description', with: 'Events about our Linux distribution'
click_button 'Update Track' click_button 'Update Track'
page.find('#flash')
end end
expected.to_not(change { Track.count }) expected.to_not(change { Track.count })

View file

@ -15,7 +15,7 @@ feature 'Has correct abilities' do
scenario 'for administration views' do scenario 'for administration views' do
visit admin_conference_path(conference.short_title) visit admin_conference_path(conference.short_title)
page.find('#flash')
expect(current_path).to eq root_path expect(current_path).to eq root_path
expect(flash).to eq 'You are not authorized to access this page.' expect(flash).to eq 'You are not authorized to access this page.'
end end

View file

@ -26,6 +26,7 @@ feature Conference do
with: 'Lorem ipsum dolor sit amet, consetetur' \ with: 'Lorem ipsum dolor sit amet, consetetur' \
'sadipscing elitr, sed diam nonumy eirmod tempor' 'sadipscing elitr, sed diam nonumy eirmod tempor'
click_button 'Create Venue' click_button 'Create Venue'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Venue was successfully created.') .to eq('Venue was successfully created.')
venue = Conference.find(conference.id).venue venue = Conference.find(conference.id).venue
@ -43,6 +44,7 @@ feature Conference do
fill_in 'venue_website', with: 'www.example.com new' fill_in 'venue_website', with: 'www.example.com new'
fill_in 'venue_description', with: 'new' fill_in 'venue_description', with: 'new'
click_button 'Update Venue' click_button 'Update Venue'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Venue was successfully updated.') .to eq('Venue was successfully updated.')
venue.reload venue.reload

View file

@ -250,6 +250,8 @@ feature 'Version' do
splashpage_id = conference.splashpage.id splashpage_id = conference.splashpage.id
click_link 'Delete' click_link 'Delete'
page.accept_alert
visit admin_revision_history_path 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} 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, expect(page).to have_text("#{organizer.name} updated public, include program, include cfp, include venue, include tickets, include lodgings,

View file

@ -29,6 +29,7 @@ feature Conference do
# find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea'). # find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
# set('Example Person') # set('Example Person')
click_button 'Update Conference' click_button 'Update Conference'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Volunteering options were successfully updated.') .to eq('Volunteering options were successfully updated.')
@ -47,6 +48,7 @@ feature Conference do
# click_link 'Remove vday' # click_link 'Remove vday'
# expect(page.all('div.nested-fields').count == 0).to be true # expect(page.all('div.nested-fields').count == 0).to be true
click_button 'Update Conference' click_button 'Update Conference'
page.find('#flash')
expect(flash).to eq('Volunteering options were successfully updated.') expect(flash).to eq('Volunteering options were successfully updated.')
expect(page.all('div.nested-fields').count == 0).to be true expect(page.all('div.nested-fields').count == 0).to be true
sign_out sign_out
@ -75,6 +77,7 @@ feature Conference do
# find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea'). # find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) textarea').
# set('Example Person') # set('Example Person')
click_button 'Update Conference' click_button 'Update Conference'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Volunteering options were successfully updated.') .to eq('Volunteering options were successfully updated.')
@ -92,6 +95,7 @@ feature Conference do
# "[id$='_vday_ids']"). # "[id$='_vday_ids']").
# find(:option, "#{Date.today.strftime}").select_option # find(:option, "#{Date.today.strftime}").select_option
click_button 'Update Conference' click_button 'Update Conference'
page.find('#flash')
expect(flash) expect(flash)
.to eq('Volunteering options were successfully updated.') .to eq('Volunteering options were successfully updated.')
@ -111,6 +115,7 @@ feature Conference do
# click_link 'Remove vposition' # click_link 'Remove vposition'
# expect(page.all('div.nested-fields').count == 1).to be true # expect(page.all('div.nested-fields').count == 1).to be true
# click_button 'Update Conference' # click_button 'Update Conference'
page.find('#flash')
expect(flash).to eq('Volunteering options were successfully updated.') expect(flash).to eq('Volunteering options were successfully updated.')
# click_link 'Remove vday' # click_link 'Remove vday'
# expect(page.all('div.nested-fields').count == 0).to be true # expect(page.all('div.nested-fields').count == 0).to be true

View file

@ -74,7 +74,7 @@ RSpec.configure do |config|
Capybara.register_driver :chrome_headless do |app| Capybara.register_driver :chrome_headless do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) } chromeOptions: { args: %w(headless disable-gpu window-size=1920x1080) }
) )
Capybara::Selenium::Driver.new( Capybara::Selenium::Driver.new(
app, browser: :chrome, desired_capabilities: capabilities app, browser: :chrome, desired_capabilities: capabilities