Merge branch 'master' of https://github.com/CactusPuppy/snapcon into 176895512-automatically-redirect-to-registration-after-buying-a-ticket
This commit is contained in:
commit
85c7b31a77
85 changed files with 740 additions and 509 deletions
|
|
@ -13,6 +13,10 @@ feature 'BaseController' do
|
|||
|
||||
describe 'GET #verify_user_admin' do
|
||||
context 'when user is a guest' do
|
||||
before(:each) do
|
||||
sign_out
|
||||
end
|
||||
|
||||
it 'redirects to sign in page' do
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq new_user_session_path
|
||||
|
|
@ -30,31 +34,31 @@ feature 'BaseController' do
|
|||
expect(flash).to eq 'You are not authorized to access this page.'
|
||||
end
|
||||
|
||||
it 'an admin he can access the admin area' do
|
||||
it 'an admin they can access the admin area' do
|
||||
user.is_admin = true
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq admin_conferences_path
|
||||
end
|
||||
|
||||
it 'an organizer he can access the admin area' do
|
||||
it 'an organizer they can access the admin area' do
|
||||
user.role_ids = organizer_role.id
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq admin_conferences_path
|
||||
end
|
||||
|
||||
it 'a volunteers_coordinator he can access the admin area' do
|
||||
it 'a volunteers_coordinator they can access the admin area' do
|
||||
user.role_ids = volunteers_coordinator_role.id
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq admin_conferences_path
|
||||
end
|
||||
|
||||
it 'a cfp he can access the admin area' do
|
||||
it 'a cfp they can access the admin area' do
|
||||
user.role_ids = cfp_role.id
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq admin_conferences_path
|
||||
end
|
||||
|
||||
it 'an info_desk he can access the admin area' do
|
||||
it 'an info_desk they can access the admin area' do
|
||||
user.role_ids = info_desk_role.id
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq admin_conferences_path
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ feature EventType do
|
|||
|
||||
fill_in 'event_type_title', with: 'Party'
|
||||
fill_in 'event_type_length', with: '240'
|
||||
fill_in 'event_type_description', with: '**Description**'
|
||||
fill_in 'event_type_submission_instructions', with: '**Instructions**'
|
||||
fill_in 'event_type_minimum_abstract_length', with: '0'
|
||||
fill_in 'event_type_maximum_abstract_length', with: '13042'
|
||||
page.find('#event_type_color').set('#e4e4e4')
|
||||
|
|
@ -29,11 +31,14 @@ feature EventType do
|
|||
click_button 'Create Event type'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
# binding.pry
|
||||
expect(flash).to eq('Event type successfully created.')
|
||||
within('table#event_types') do
|
||||
expect(page.has_content?('Party')).to be true
|
||||
expect(page.has_content?('13042')).to be true
|
||||
expect(page.has_content?('#E4E4E4')).to be true
|
||||
expect(page.has_content?('Description')).to be true
|
||||
expect(page.has_content?('Instructions')).to be true
|
||||
expect(page.assert_selector('tr', count: 3)).to be true
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,21 @@ feature Event do
|
|||
sign_in organizer
|
||||
end
|
||||
|
||||
scenario 'can preview a proposal if it is public', feature: true, js: true do
|
||||
visit admin_conference_program_event_path(conference.short_title, @event)
|
||||
expect(page).to have_selector(:link_or_button, 'Preview')
|
||||
click_link 'Preview'
|
||||
expect(current_path).to eq(conference_program_proposal_path(conference.short_title, @event.id))
|
||||
end
|
||||
|
||||
scenario 'cannot preview a proposal if it is not public', feature: true, js: true do
|
||||
event = create(:event, program: conference.program, title: 'Example Proposal')
|
||||
event.public = false
|
||||
event.save!
|
||||
visit admin_conference_program_event_path(conference.short_title, event)
|
||||
expect(page).to_not have_selector(:link_or_button, 'Preview')
|
||||
end
|
||||
|
||||
scenario 'rejects a proposal', feature: true, js: true do
|
||||
visit admin_conference_program_events_path(conference.short_title)
|
||||
expect(page).to have_content 'Example Proposal'
|
||||
|
|
@ -82,6 +97,7 @@ feature Event do
|
|||
fill_in 'event_title', with: 'Example Proposal'
|
||||
select('Example Event Type', from: 'event[event_type_id]')
|
||||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||
fill_in 'event_submission_text', with: 'Lorem ipsum submission'
|
||||
|
||||
click_button 'Submit Proposal'
|
||||
page.find('#flash')
|
||||
|
|
@ -91,6 +107,17 @@ feature Event do
|
|||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
|
||||
scenario 'edit proposal without cfp' do
|
||||
conference = create(:conference)
|
||||
proposal = create(:event, program: conference.program)
|
||||
|
||||
sign_in proposal.submitter
|
||||
|
||||
visit edit_conference_program_proposal_path(proposal.program.conference.short_title, proposal)
|
||||
|
||||
expect(page).to have_content 'Proposal Information'
|
||||
end
|
||||
|
||||
scenario 'update a proposal' do
|
||||
conference = create(:conference)
|
||||
create(:cfp, program: conference.program)
|
||||
|
|
@ -120,9 +147,15 @@ feature Event do
|
|||
select('Example Event Type', from: 'event[event_type_id]')
|
||||
expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation
|
||||
|
||||
expect(page).to have_text('Example Event Description')
|
||||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||
expect(page).to have_text('You have used 3 words')
|
||||
|
||||
fill_in 'event_submission_text', with: 'Lorem ipsum submission_text'
|
||||
expect(page).to have_text('Submission text')
|
||||
# Submission Instructions content
|
||||
expect(page).to have_text('Example Event Instructions')
|
||||
|
||||
click_link 'Do you require something special?'
|
||||
fill_in 'event_description', with: 'Lorem ipsum description'
|
||||
|
||||
|
|
@ -158,5 +191,24 @@ feature Event do
|
|||
@event.reload
|
||||
expect(@event.state).to eq('withdrawn')
|
||||
end
|
||||
|
||||
scenario 'can reset to text template', feature: true, js: true do
|
||||
event_type = conference.program.event_types[-1]
|
||||
event_type.description = 'Example event description'
|
||||
event_type.save!
|
||||
|
||||
sign_in participant
|
||||
visit new_conference_program_proposal_path(conference.short_title)
|
||||
|
||||
fill_in 'event_title', with: 'Example Proposal'
|
||||
select(event_type.title, from: 'event[event_type_id]')
|
||||
fill_in 'event_submission_text', with: 'Lorem ipsum example submission text'
|
||||
|
||||
accept_confirm do
|
||||
click_button 'Reset to Template'
|
||||
end
|
||||
|
||||
expect(page.find('#event_submission_text').value).to eq(event_type.description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,6 +11,25 @@ feature Registration, feature: true, js: true do
|
|||
let!(:conference) { create(:conference, title: 'ExampleCon', tickets: [ticket, free_ticket, first_registration_ticket, second_registration_ticket, third_registration_ticket], registration_period: create(:registration_period, start_date: 3.days.ago)) }
|
||||
let!(:participant) { create(:user) }
|
||||
|
||||
def make_stripe_purchase(card_number='4242424242424242')
|
||||
find('.stripe-button-el').click
|
||||
|
||||
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
|
||||
sleep(5)
|
||||
Capybara.within_frame stripe_iframe do
|
||||
expect(page).to have_content("#{ENV['OSEM_NAME']} tickets")
|
||||
fill_in 'Card number', with: card_number
|
||||
fill_in 'Expiry', with: '08/22'
|
||||
fill_in 'CVC', with: '123'
|
||||
click_button '$20.00'
|
||||
sleep(20)
|
||||
end
|
||||
end
|
||||
|
||||
def make_failed_stripe_purchase
|
||||
make_stripe_purchase('4000000000000341')
|
||||
end
|
||||
|
||||
context 'as a participant' do
|
||||
before(:each) do
|
||||
sign_in participant
|
||||
|
|
@ -22,7 +41,7 @@ feature Registration, feature: true, js: true do
|
|||
|
||||
context 'who is not registered' do
|
||||
|
||||
scenario 'purchases and pays for a ticket succcessfully', feature: true, js: true do
|
||||
scenario 'purchases and pays for a ticket succcessfully' do
|
||||
visit root_path
|
||||
click_link 'Register'
|
||||
|
||||
|
|
@ -39,22 +58,11 @@ feature Registration, feature: true, js: true do
|
|||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
if Rails.application.secrets.stripe_publishable_key
|
||||
find('.stripe-button-el').click
|
||||
|
||||
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
|
||||
sleep(5)
|
||||
Capybara.within_frame stripe_iframe do
|
||||
expect(page).to have_content('book your tickets')
|
||||
page.execute_script(%{ $('input#card_number').val('4242424242424242'); })
|
||||
page.execute_script(%{ $('input#cc-exp').val('08/22'); })
|
||||
page.execute_script(%{ $('input#cc-csc').val('123'); })
|
||||
page.execute_script(%{ $('#submitButton').click(); })
|
||||
sleep(20)
|
||||
end
|
||||
|
||||
expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
|
||||
expect(page.has_content?("2 #{ticket.title} Tickets for $ 10")).to be true
|
||||
if ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key
|
||||
make_stripe_purchase
|
||||
# expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
|
||||
expect(current_path).to eq(conference_physical_tickets_path(conference.short_title))
|
||||
expect(page).to have_content 'Your ticket is booked successfully.'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -75,19 +83,8 @@ feature Registration, feature: true, js: true do
|
|||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
if Rails.application.secrets.stripe_publishable_key
|
||||
find('.stripe-button-el').click
|
||||
|
||||
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
|
||||
sleep(5)
|
||||
Capybara.within_frame stripe_iframe do
|
||||
expect(page).to have_content('book your tickets')
|
||||
page.execute_script(%{ $('input#card_number').val('4000000000000341'); })
|
||||
page.execute_script(%{ $('input#cc-exp').val('08/22'); })
|
||||
page.execute_script(%{ $('input#cc-csc').val('123'); })
|
||||
page.execute_script(%{ $('#submitButton').click(); })
|
||||
sleep(20)
|
||||
end
|
||||
if ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key
|
||||
make_failed_stripe_purchase
|
||||
page.find('#flash')
|
||||
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.')
|
||||
|
|
@ -203,6 +200,7 @@ feature Registration, feature: true, js: true do
|
|||
context 'who is registered' do
|
||||
|
||||
scenario 'unregisters from conference, but ticket purchases dont delete' do
|
||||
pending('SNAPCON: Investigate failure on the unregister button')
|
||||
visit root_path
|
||||
click_link 'Register'
|
||||
|
||||
|
|
@ -219,22 +217,11 @@ feature Registration, feature: true, js: true do
|
|||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
if Rails.application.secrets.stripe_publishable_key
|
||||
find('.stripe-button-el').click
|
||||
|
||||
stripe_iframe = all('iframe[name=stripe_checkout_app]').last
|
||||
sleep(5)
|
||||
Capybara.within_frame stripe_iframe do
|
||||
expect(page).to have_content('book your tickets')
|
||||
page.execute_script(%{ $('input#card_number').val('4242424242424242'); })
|
||||
page.execute_script(%{ $('input#cc-exp').val('08/22'); })
|
||||
page.execute_script(%{ $('input#cc-csc').val('123'); })
|
||||
page.execute_script(%{ $('#submitButton').click(); })
|
||||
sleep(20)
|
||||
end
|
||||
|
||||
expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
|
||||
expect(page.has_content?("2 #{ticket.title} Tickets for $ 10")).to be true
|
||||
if ENV['STRIPE_PUBLISHABLE_KEY'] || Rails.application.secrets.stripe_publishable_key
|
||||
make_stripe_purchase
|
||||
# expect(current_path).to eq(conference_conference_registration_path(conference.short_title))
|
||||
expect(current_path).to eq(conference_physical_tickets_path(conference.short_title))
|
||||
expect(page).to have_content 'Your ticket is booked successfully.'
|
||||
|
||||
click_button 'Unregister'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ feature 'Version' do
|
|||
end
|
||||
|
||||
# TODO-SNAPCON: Figure out why this is failing!!
|
||||
skip 'display changes in splashpages', feature: true, versioning: true, js: true do
|
||||
xscenario 'display changes in splashpages', feature: true, versioning: true, js: true do
|
||||
visit admin_conference_splashpage_path(conference.short_title)
|
||||
click_link 'Create Splashpage'
|
||||
click_button 'Save Changes'
|
||||
|
|
@ -247,15 +247,15 @@ feature 'Version' do
|
|||
uncheck('Display social media links')
|
||||
check('Make splash page public?')
|
||||
click_button 'Save Changes'
|
||||
splashpage_id = conference.splashpage.id
|
||||
|
||||
click_link 'Delete'
|
||||
page.accept_alert
|
||||
expect(page).to have_text('Splashpage was successfully destroyed')
|
||||
|
||||
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} deleted splashpage with ID #{splashpage_id} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("#{organizer.name} created new splashpage 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 in conference #{conference.short_title}")
|
||||
expect(page).to have_text("#{organizer.name} deleted splashpage in conference #{conference.short_title}")
|
||||
end
|
||||
|
||||
scenario 'displays users subscribe/unsubscribe to conferences', feature: true, versioning: true, js: true do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue