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 | Feature: manage product price details | 1 | Feature: manage product price details |
| 3 | As an enterprise owner | 2 | As an enterprise owner |
| 4 | I want to manage the details of product's price | 3 | I want to manage the details of product's price |
| @@ -28,39 +27,33 @@ Feature: manage product price details | @@ -28,39 +27,33 @@ Feature: manage product price details | ||
| 28 | And the following production cost | 27 | And the following production cost |
| 29 | | name | owner | | 28 | | name | owner | |
| 30 | | Taxes | environment | | 29 | | Taxes | environment | |
| 30 | + And I am logged in as "joaosilva" | ||
| 31 | 31 | ||
| 32 | @selenium | 32 | @selenium |
| 33 | Scenario: list total value of inputs as price details | 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 | And I follow "Describe here the cost of production" | 36 | And I follow "Describe here the cost of production" |
| 37 | Then I should see "Inputs" | 37 | Then I should see "Inputs" |
| 38 | And I should see "60.0" within ".inputs-cost" | 38 | And I should see "60.0" within ".inputs-cost" |
| 39 | 39 | ||
| 40 | @selenium | 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 | Scenario: return to product after save | 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 | And I follow "Describe here the cost of production" | 44 | And I follow "Describe here the cost of production" |
| 53 | And I press "Save" | 45 | And I press "Save" |
| 54 | Then I should be on Rede Moinho's page of product Abbey Road | 46 | Then I should be on Rede Moinho's page of product Abbey Road |
| 55 | 47 | ||
| 56 | @selenium | 48 | @selenium |
| 57 | Scenario: add first item on price details | 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 | And I follow "Describe here the cost of production" | 52 | And I follow "Describe here the cost of production" |
| 61 | And I follow "New cost" | 53 | And I follow "New cost" |
| 62 | And I select "Taxes" | 54 | And I select "Taxes" |
| 63 | And I fill in "$" with "5.00" | 55 | And I fill in "$" with "5.00" |
| 56 | + And I leave the ".price-details-price" field | ||
| 64 | And I press "Save" | 57 | And I press "Save" |
| 65 | Then I should not see "Save" | 58 | Then I should not see "Save" |
| 66 | And I should see "Describe here the cost of production" | 59 | And I should see "Describe here the cost of production" |
| @@ -70,17 +63,19 @@ Feature: manage product price details | @@ -70,17 +63,19 @@ Feature: manage product price details | ||
| 70 | Given the following production cost | 63 | Given the following production cost |
| 71 | | name | owner | | 64 | | name | owner | |
| 72 | | Energy | environment | | 65 | | Energy | environment | |
| 73 | - Given I am logged in as "joaosilva" | ||
| 74 | When I go to Rede Moinho's page of product Abbey Road | 66 | When I go to Rede Moinho's page of product Abbey Road |
| 67 | + And I follow "Price composition" | ||
| 75 | And I follow "Describe here the cost of production" | 68 | And I follow "Describe here the cost of production" |
| 76 | And I follow "New cost" | 69 | And I follow "New cost" |
| 77 | And I select "Taxes" | 70 | And I select "Taxes" |
| 78 | And I fill in "$" with "20.00" | 71 | And I fill in "$" with "20.00" |
| 72 | + And I leave the ".price-details-price" field | ||
| 79 | And I press "Save" | 73 | And I press "Save" |
| 80 | Then I should not see "Save" | 74 | Then I should not see "Save" |
| 81 | And I should see "Taxes" within "#display-price-details" | 75 | And I should see "Taxes" within "#display-price-details" |
| 82 | When I follow "Describe here the cost of production" | 76 | When I follow "Describe here the cost of production" |
| 83 | And I select "Energy" | 77 | And I select "Energy" |
| 78 | + And I leave the ".price-details-price" field | ||
| 84 | And I press "Save" | 79 | And I press "Save" |
| 85 | And I should not see "Taxes" within "#display-price-details" | 80 | And I should not see "Taxes" within "#display-price-details" |
| 86 | And I should see "Energy" within "#display-price-details" | 81 | And I should see "Energy" within "#display-price-details" |
| @@ -94,16 +89,18 @@ Feature: manage product price details | @@ -94,16 +89,18 @@ Feature: manage product price details | ||
| 94 | | mariasouza | Maria Souza | | 89 | | mariasouza | Maria Souza | |
| 95 | And I am logged in as "mariasouza" | 90 | And I am logged in as "mariasouza" |
| 96 | When I go to Rede Moinho's page of product Yellow Submarine | 91 | When I go to Rede Moinho's page of product Yellow Submarine |
| 92 | + And I follow "Price composition" | ||
| 97 | Then I should not see "Describe here the cost of production" | 93 | Then I should not see "Describe here the cost of production" |
| 98 | 94 | ||
| 99 | Scenario: not display price details if price is not fully described | 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 | Then I should not see "60.0" | 98 | Then I should not see "60.0" |
| 102 | 99 | ||
| 103 | @selenium | 100 | @selenium |
| 104 | Scenario: display price details if price is fully described | 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 | And I follow "Describe here the cost of production" | 104 | And I follow "Describe here the cost of production" |
| 108 | And I follow "New cost" | 105 | And I follow "New cost" |
| 109 | And I select "Taxes" | 106 | And I select "Taxes" |
| @@ -114,19 +111,22 @@ Feature: manage product price details | @@ -114,19 +111,22 @@ Feature: manage product price details | ||
| 114 | 111 | ||
| 115 | @selenium | 112 | @selenium |
| 116 | Scenario: create a new cost clicking on select | 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 | And I follow "Describe here the cost of production" | 116 | And I follow "Describe here the cost of production" |
| 117 | + And I follow "New cost" | ||
| 120 | And I want to add "Energy" as cost | 118 | And I want to add "Energy" as cost |
| 121 | And I select "Other cost" | 119 | And I select "Other cost" |
| 120 | + And I fill in "$" with "10.00" | ||
| 121 | + And I leave the ".price-details-price" field | ||
| 122 | And I press "Save" | 122 | And I press "Save" |
| 123 | When I follow "Describe here the cost of production" | 123 | When I follow "Describe here the cost of production" |
| 124 | Then I should see "Energy" within ".production-cost-selection" | 124 | Then I should see "Energy" within ".production-cost-selection" |
| 125 | 125 | ||
| 126 | @selenium | 126 | @selenium |
| 127 | Scenario: add created cost on new-cost-fields | 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 | And I follow "Describe here the cost of production" | 130 | And I follow "Describe here the cost of production" |
| 131 | And I want to add "Energy" as cost | 131 | And I want to add "Energy" as cost |
| 132 | And I select "Other cost" | 132 | And I select "Other cost" |
| @@ -137,8 +137,8 @@ Feature: manage product price details | @@ -137,8 +137,8 @@ Feature: manage product price details | ||
| 137 | Given the following price detail | 137 | Given the following price detail |
| 138 | | product | production_cost | price | | 138 | | product | production_cost | price | |
| 139 | | Abbey Road | Taxes | 20.0 | | 139 | | Abbey Road | Taxes | 20.0 | |
| 140 | - And I am logged in as "joaosilva" | ||
| 141 | And I go to Rede Moinho's page of product Abbey Road | 140 | And I go to Rede Moinho's page of product Abbey Road |
| 141 | + And I follow "Price composition" | ||
| 142 | And I follow "Describe here the cost of production" | 142 | And I follow "Describe here the cost of production" |
| 143 | And I should see "Taxes" within "#manage-product-details-form" | 143 | And I should see "Taxes" within "#manage-product-details-form" |
| 144 | When I follow "Remove" within "#manage-product-details-form" | 144 | When I follow "Remove" within "#manage-product-details-form" |
| @@ -146,3 +146,33 @@ Feature: manage product price details | @@ -146,3 +146,33 @@ Feature: manage product price details | ||
| 146 | And I press "Save" | 146 | And I press "Save" |
| 147 | And I follow "Describe here the cost of production" | 147 | And I follow "Describe here the cost of production" |
| 148 | Then I should not see "Taxes" within "#manage-product-details-form" | 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,3 +127,7 @@ When /^I follow "([^\"]*)" and wait for jquery$/ do |link| | ||
| 127 | click_link(link) | 127 | click_link(link) |
| 128 | selenium.wait_for(:wait_for => :ajax, :javascript_framework => framework) | 128 | selenium.wait_for(:wait_for => :ajax, :javascript_framework => framework) |
| 129 | end | 129 | end |
| 130 | + | ||
| 131 | +When /^I leave the "([^\"]+)" field$/ do |field| | ||
| 132 | + selenium.fire_event("css=#{field}", "blur") | ||
| 133 | +end |