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 -1
View File
@@ -20,5 +20,5 @@ step 'a new order on a table in another section is created' do
# @new_section = create :section, title: 'Terrace', supplier: @supplier
# @new_table = create :table, number: 59, section: @new_section, supplier: @supplier
@new_list = create :list, section: @other_section, table: @other_table, supplier: @supplier, user_ids: [@user.id]
@new_order = @new_list.place_order(product_orders: [ {'product_id' => @product.id, 'quantity' => 3}], user: @user)
@new_order = @new_list.place_order(product_orders: [ {'product_id' => @product.id, 'quantity' => 3}], user: @user, first_order: true)
end
+1 -1
View File
@@ -1,7 +1,7 @@
step "A new order is placed" do
@user ||= create :user
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
@order = @list.place_order product_orders: [{ 'product_id' => @product.id, 'quantity' => 2}], user: @user
@order = @list.place_order product_orders: [{ 'product_id' => @product.id, 'quantity' => 2}], user: @user, first_order: true
end
step "an order with :quantity products :product_name should have been created" do |quantity, product_name|
+5 -3
View File
@@ -1,6 +1,8 @@
step "the user scans a table QR code" do
step 'there is a table'
page.execute_script "App.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
when_ember_is_ready do
page.execute_script "MozoUser.__container__.lookup('route:application').transitionTo('table','#{@table.id}')"
end
end
step "I am on the user homepage" do
@@ -8,12 +10,12 @@ step "I am on the user homepage" do
end
step "the user is on the homepage" do
visit '/user'
user_visit '/'
end
step "the user should be redirected to the user order overview page" do
#route_should_be 'user#active_list'
ember_route_should_be "/active_list"
ember_route_should_be "/active-list"
end
step "the user should be redirected to the archived list path" do
+1 -1
View File
@@ -9,7 +9,7 @@ step "the order should be marked as delivered" do
end
step "another order is placed" do
@new_order = @list.place_order(product_orders: [{ 'product_id' => @product.id, 'quantity' => 5}], user: @user)
@new_order = @list.place_order(product_orders: [{ 'product_id' => @product.id, 'quantity' => 5}], user: @user, first_order: false)
end
step "the user order should be created as a new order" do
@@ -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