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