Commit 5a1eee95f424aa559aaa98eca6bf99436cf4e997

Authored by Braulio Bhavamitra
1 parent a89adf35

shopping_cart: wait for animations and requests to finish (fix test)

features/step_definitions/web_steps.rb
@@ -315,3 +315,8 @@ When /^(?:|I )follow exact "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| @@ -315,3 +315,8 @@ When /^(?:|I )follow exact "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
315 find("a", :text => /\A#{link}\z/).click 315 find("a", :text => /\A#{link}\z/).click
316 end 316 end
317 end 317 end
  318 +
  319 +When /^(?:|I )wait ([^ ]+) seconds?(?:| .+)$/ do |seconds|
  320 + sleep seconds.to_f
  321 +end
  322 +
plugins/shopping_cart/features/delivery_admin.feature
@@ -62,7 +62,7 @@ Feature: delivery administration @@ -62,7 +62,7 @@ Feature: delivery administration
62 Then I should see "Bike" 62 Then I should see "Bike"
63 And I follow "Remove" within ".delivery-method" 63 And I follow "Remove" within ".delivery-method"
64 When I confirm the browser dialog 64 When I confirm the browser dialog
65 - Then I should see "Bike" 65 + Then I should not see "Bike"
66 66
67 @selenium 67 @selenium
68 Scenario: edit delivery 68 Scenario: edit delivery
plugins/shopping_cart/features/delivery_client.feature
@@ -35,9 +35,10 @@ Feature: delivery client @@ -35,9 +35,10 @@ Feature: delivery client
35 Given I follow "Add to basket" 35 Given I follow "Add to basket"
36 And I follow "Add to basket" 36 And I follow "Add to basket"
37 And I should see "Show basket" 37 And I should see "Show basket"
38 - And I follow "Show basket" 38 + And I follow "Show "
  39 + And I wait 1 second for animations
39 And I follow "Shopping checkout" 40 And I follow "Shopping checkout"
40 - And I fill in "order_consumer_data_contact_phone" with "123456789" 41 + And I fill in "Contact phone" with "123456789"
41 When I select "Bike ($8.00)" from "Option" 42 When I select "Bike ($8.00)" from "Option"
42 Then I should see "My good old bike." within ".instructions" 43 Then I should see "My good old bike." within ".instructions"
43 And I should see "Address" 44 And I should see "Address"
@@ -50,8 +51,9 @@ Feature: delivery client @@ -50,8 +51,9 @@ Feature: delivery client
50 And I follow "Add to basket" 51 And I follow "Add to basket"
51 And I should see "Show basket" 52 And I should see "Show basket"
52 And I follow "Show basket" 53 And I follow "Show basket"
  54 + And I wait 1 second for animations
53 And I follow "Shopping checkout" 55 And I follow "Shopping checkout"
54 - And I fill in "order_consumer_data_contact_phone" with "123456789" 56 + And I fill in "Contact phone" with "123456789"
55 When I select "Bar" from "Option" 57 When I select "Bar" from "Option"
56 Then I should see "Come to my bar and drink it!" within ".instructions" 58 Then I should see "Come to my bar and drink it!" within ".instructions"
57 And I should not see "Address" 59 And I should not see "Address"
@@ -68,8 +70,9 @@ Feature: delivery client @@ -68,8 +70,9 @@ Feature: delivery client
68 And I follow "Add to basket" 70 And I follow "Add to basket"
69 And I should see "Show basket" 71 And I should see "Show basket"
70 And I follow "Show basket" 72 And I follow "Show basket"
  73 + And I wait 1 second for animations
71 And I follow "Shopping checkout" 74 And I follow "Shopping checkout"
72 - And I fill in "order_consumer_data_contact_phone" with "123456789" 75 + And I fill in "Contact phone" with "123456789"
73 When I select "Bike ($8.00)" from "Option" 76 When I select "Bike ($8.00)" from "Option"
74 Then I should see "My good old bike." within ".instructions" 77 Then I should see "My good old bike." within ".instructions"
75 And I should see "Address" 78 And I should see "Address"
plugins/shopping_cart/features/purchases.feature
@@ -121,11 +121,14 @@ Feature: purchases @@ -121,11 +121,14 @@ Feature: purchases
121 | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 | 121 | pickup | Bar | Come to my bar and drink it! | 0.00 | 0.00 |
122 And I am on moes-tavern's products page 122 And I am on moes-tavern's products page
123 And I follow "Add to basket" 123 And I follow "Add to basket"
  124 + And I wait 0.2 seconds to finish the request
124 And I follow "Add to basket" 125 And I follow "Add to basket"
  126 + And I wait 0.2 seconds to finish the request
125 And I follow "Add to basket" 127 And I follow "Add to basket"
126 And I follow "Show basket" 128 And I follow "Show basket"
  129 + And I wait 1 second for animations
127 And I follow "Shopping checkout" 130 And I follow "Shopping checkout"
128 - And I fill in "order_consumer_data_contact_phone" with "123456789" 131 + And I fill in "Contact phone" with "123456789"
129 And I select "Bike ($8.00)" from "Option" 132 And I select "Bike ($8.00)" from "Option"
130 And I press "Send buy request" 133 And I press "Send buy request"
131 And I go to homer's control panel 134 And I go to homer's control panel