Commit 1c390d094f85be7d3d2e81ec9120a7f24e1132e7
1 parent
6952dd5c
Exists in
master
and in
22 other branches
Added selenium tests to progressbar
(ActionItem1413)
Showing
2 changed files
with
58 additions
and
24 deletions
Show diff stats
features/manage_product_price_details.feature
| 1 | - | |
| 2 | 1 | Feature: manage product price details |
| 3 | 2 | As an enterprise owner |
| 4 | 3 | I want to manage the details of product's price |
| ... | ... | @@ -28,39 +27,33 @@ Feature: manage product price details |
| 28 | 27 | And the following production cost |
| 29 | 28 | | name | owner | |
| 30 | 29 | | Taxes | environment | |
| 30 | + And I am logged in as "joaosilva" | |
| 31 | 31 | |
| 32 | 32 | @selenium |
| 33 | 33 | Scenario: list total value of inputs as price details |
| 34 | - Given I am logged in as "joaosilva" | |
| 35 | - When I go to Rede Moinho's page of product Abbey Road | |
| 34 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 35 | + And I follow "Price composition" | |
| 36 | 36 | And I follow "Describe here the cost of production" |
| 37 | 37 | Then I should see "Inputs" |
| 38 | 38 | And I should see "60.0" within ".inputs-cost" |
| 39 | 39 | |
| 40 | 40 | @selenium |
| 41 | - Scenario: cancel management of price details | |
| 42 | - Given I am logged in as "joaosilva" | |
| 43 | - When I go to Rede Moinho's page of product Abbey Road | |
| 44 | - And I follow "Describe here the cost of production" | |
| 45 | - When I follow "Cancel" | |
| 46 | - Then I should see "Describe here the cost of production" | |
| 47 | - | |
| 48 | - @selenium | |
| 49 | 41 | Scenario: return to product after save |
| 50 | - Given I am logged in as "joaosilva" | |
| 51 | - When I go to Rede Moinho's page of product Abbey Road | |
| 42 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 43 | + And I follow "Price composition" | |
| 52 | 44 | And I follow "Describe here the cost of production" |
| 53 | 45 | And I press "Save" |
| 54 | 46 | Then I should be on Rede Moinho's page of product Abbey Road |
| 55 | 47 | |
| 56 | 48 | @selenium |
| 57 | 49 | Scenario: add first item on price details |
| 58 | - Given I am logged in as "joaosilva" | |
| 59 | - When I go to Rede Moinho's page of product Abbey Road | |
| 50 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 51 | + And I follow "Price composition" | |
| 60 | 52 | And I follow "Describe here the cost of production" |
| 61 | 53 | And I follow "New cost" |
| 62 | 54 | And I select "Taxes" |
| 63 | 55 | And I fill in "$" with "5.00" |
| 56 | + And I leave the ".price-details-price" field | |
| 64 | 57 | And I press "Save" |
| 65 | 58 | Then I should not see "Save" |
| 66 | 59 | And I should see "Describe here the cost of production" |
| ... | ... | @@ -70,17 +63,19 @@ Feature: manage product price details |
| 70 | 63 | Given the following production cost |
| 71 | 64 | | name | owner | |
| 72 | 65 | | Energy | environment | |
| 73 | - Given I am logged in as "joaosilva" | |
| 74 | 66 | When I go to Rede Moinho's page of product Abbey Road |
| 67 | + And I follow "Price composition" | |
| 75 | 68 | And I follow "Describe here the cost of production" |
| 76 | 69 | And I follow "New cost" |
| 77 | 70 | And I select "Taxes" |
| 78 | 71 | And I fill in "$" with "20.00" |
| 72 | + And I leave the ".price-details-price" field | |
| 79 | 73 | And I press "Save" |
| 80 | 74 | Then I should not see "Save" |
| 81 | 75 | And I should see "Taxes" within "#display-price-details" |
| 82 | 76 | When I follow "Describe here the cost of production" |
| 83 | 77 | And I select "Energy" |
| 78 | + And I leave the ".price-details-price" field | |
| 84 | 79 | And I press "Save" |
| 85 | 80 | And I should not see "Taxes" within "#display-price-details" |
| 86 | 81 | And I should see "Energy" within "#display-price-details" |
| ... | ... | @@ -94,16 +89,18 @@ Feature: manage product price details |
| 94 | 89 | | mariasouza | Maria Souza | |
| 95 | 90 | And I am logged in as "mariasouza" |
| 96 | 91 | When I go to Rede Moinho's page of product Yellow Submarine |
| 92 | + And I follow "Price composition" | |
| 97 | 93 | Then I should not see "Describe here the cost of production" |
| 98 | 94 | |
| 99 | 95 | Scenario: not display price details if price is not fully described |
| 100 | - Given I go to Rede Moinho's page of product Abbey Road | |
| 96 | + Given I am not logged in | |
| 97 | + And I go to Rede Moinho's page of product Abbey Road | |
| 101 | 98 | Then I should not see "60.0" |
| 102 | 99 | |
| 103 | 100 | @selenium |
| 104 | 101 | Scenario: display price details if price is fully described |
| 105 | - Given I am logged in as "joaosilva" | |
| 106 | - And I go to Rede Moinho's page of product Abbey Road | |
| 102 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 103 | + And I follow "Price composition" | |
| 107 | 104 | And I follow "Describe here the cost of production" |
| 108 | 105 | And I follow "New cost" |
| 109 | 106 | And I select "Taxes" |
| ... | ... | @@ -114,19 +111,22 @@ Feature: manage product price details |
| 114 | 111 | |
| 115 | 112 | @selenium |
| 116 | 113 | Scenario: create a new cost clicking on select |
| 117 | - Given I am logged in as "joaosilva" | |
| 118 | - And I go to Rede Moinho's page of product Abbey Road | |
| 114 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 115 | + And I follow "Price composition" | |
| 119 | 116 | And I follow "Describe here the cost of production" |
| 117 | + And I follow "New cost" | |
| 120 | 118 | And I want to add "Energy" as cost |
| 121 | 119 | And I select "Other cost" |
| 120 | + And I fill in "$" with "10.00" | |
| 121 | + And I leave the ".price-details-price" field | |
| 122 | 122 | And I press "Save" |
| 123 | 123 | When I follow "Describe here the cost of production" |
| 124 | 124 | Then I should see "Energy" within ".production-cost-selection" |
| 125 | 125 | |
| 126 | 126 | @selenium |
| 127 | 127 | Scenario: add created cost on new-cost-fields |
| 128 | - Given I am logged in as "joaosilva" | |
| 129 | - And I go to Rede Moinho's page of product Abbey Road | |
| 128 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 129 | + And I follow "Price composition" | |
| 130 | 130 | And I follow "Describe here the cost of production" |
| 131 | 131 | And I want to add "Energy" as cost |
| 132 | 132 | And I select "Other cost" |
| ... | ... | @@ -137,8 +137,8 @@ Feature: manage product price details |
| 137 | 137 | Given the following price detail |
| 138 | 138 | | product | production_cost | price | |
| 139 | 139 | | Abbey Road | Taxes | 20.0 | |
| 140 | - And I am logged in as "joaosilva" | |
| 141 | 140 | And I go to Rede Moinho's page of product Abbey Road |
| 141 | + And I follow "Price composition" | |
| 142 | 142 | And I follow "Describe here the cost of production" |
| 143 | 143 | And I should see "Taxes" within "#manage-product-details-form" |
| 144 | 144 | When I follow "Remove" within "#manage-product-details-form" |
| ... | ... | @@ -146,3 +146,33 @@ Feature: manage product price details |
| 146 | 146 | And I press "Save" |
| 147 | 147 | And I follow "Describe here the cost of production" |
| 148 | 148 | Then I should not see "Taxes" within "#manage-product-details-form" |
| 149 | + | |
| 150 | + Scenario: display progressbar | |
| 151 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 152 | + And I follow "Price composition" | |
| 153 | + And I follow "Describe here the cost of production" | |
| 154 | + Then I should see "$ 60.00 of $ 80.00" within "#progressbar-text" | |
| 155 | + | |
| 156 | + @selenium | |
| 157 | + Scenario: update value on progressbar after addition of new cost | |
| 158 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 159 | + And I follow "Price composition" | |
| 160 | + And I follow "Describe here the cost of production" | |
| 161 | + Then I should see "$ 60.00 of $ 80.00" within "#progressbar-text" | |
| 162 | + And I follow "New cost" | |
| 163 | + And I fill in "$" with "10.00" | |
| 164 | + And I leave the ".price-details-price" field | |
| 165 | + Then I should see "$ 70.00 of $ 80.00" within "#progressbar-text" | |
| 166 | + | |
| 167 | + @selenium | |
| 168 | + Scenario: update value on progressbar after editing an input | |
| 169 | + Given I go to Rede Moinho's page of product Abbey Road | |
| 170 | + And I follow "Price composition" | |
| 171 | + And I follow "Describe here the cost of production" | |
| 172 | + Then I should see "$ 60.00 of $ 80.00" within "#progressbar-text" | |
| 173 | + When I follow "Inputs" | |
| 174 | + And I follow "Edit" within ".input-details" | |
| 175 | + And I fill in "Price" with "23.31" | |
| 176 | + And I press "Save" | |
| 177 | + Then I follow "Price composition" | |
| 178 | + And I should see "$ 86.62 of $ 80.00" within "#progressbar-text" | ... | ... |
features/step_definitions/selenium_steps.rb
| ... | ... | @@ -127,3 +127,7 @@ When /^I follow "([^\"]*)" and wait for jquery$/ do |link| |
| 127 | 127 | click_link(link) |
| 128 | 128 | selenium.wait_for(:wait_for => :ajax, :javascript_framework => framework) |
| 129 | 129 | end |
| 130 | + | |
| 131 | +When /^I leave the "([^\"]+)" field$/ do |field| | |
| 132 | + selenium.fire_event("css=#{field}", "blur") | |
| 133 | +end | ... | ... |