Acceptance tests for user

This commit is contained in:
2015-09-17 17:46:33 +02:00
parent 8e931cabd4
commit cb744943bd
35 changed files with 91 additions and 49 deletions
@@ -1,15 +1,11 @@
step "there is no user information stored in the local storage" do
visit '/'
user_visit '/'
page.execute_script %|Qstorage = window.localStorage|
page.execute_script(%|Qstorage.removeItem('user_id')|)
page.execute_script(%|Qstorage.removeItem('auth_token')|)
end
step "I visit the user obtain token path" do
visit user_root_path # obtain token through ember application
end
step "there is a user" do
@user ||= create :user
end
@@ -33,7 +33,9 @@ step "there is another table with an active list of another user" do
end
step "the user scans a QR code of another not occupied table" do
page.execute_script %|App.__container__.lookup('controller:select_qrcode').send('selectQr', {_id: "#{@other_table.id}"})|
when_ember_is_ready do
page.execute_script %|MozoUser.__container__.lookup('route:application').send('selectQr', {_id: "#{@other_table.id}"})|
end
#page.execute_script "Quser.actions_for_table({table_id: '#{@other_table.id}'})"
end
@@ -7,7 +7,7 @@ step "the user clicks on the submit feedback button" do
end
step "the user should see the feedback submitted message" do
page.should have_content I18n.t('user.about.feedback.received')
page.should have_content 'Thank you for your feedback'
end
step "a user feedback should be created containing the feedback" do
@@ -16,12 +16,16 @@ end
step "another user scans the QR code on the table" do
step 'there is another signed in user user'
visit user_root_path
user_visit '/'
when_ember_is_ready do
page.execute_script "App.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
page.execute_script "MozoUser.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
end
end
step "the original user should see the other user added below the active list" do
page.evaluate_script(%|$('.list-user-total-container').length()|).should eq 2
end
step "the original user approves the other user's join request" do
find('.join-request-approve').click
end
@@ -67,5 +71,5 @@ end
step "the other user should be redirected to active list it just joined" do
Capybara.session_name = :other_user
ember_route_should_be '/active_list'
ember_route_should_be '/active-list'
end
@@ -43,7 +43,7 @@ step "there is another signed in user on the same list" do
end
step 'the other user orders a product :count times' do |count|
@list.place_order product_orders: [{'product_id' => @product.id, 'quantity' => count.to_i}], user: @other_user
@list.place_order product_orders: [{'product_id' => @product.id, 'quantity' => count.to_i}], user: @other_user, first_order: false
end
step 'the other user is part of the list' do
@@ -111,7 +111,7 @@ step "the user should see an empty active order panel" do
end
step 'the user is on the order products page' do
visit "/user#/tables/#{@table.id}"
user_visit "tables/#{@table.id}"
end
step 'the user should see the products listed for the active list' do