Commit 37105a381e9e67c70204221962faa3ac5bd7d5e0
1 parent
972a12ab
Exists in
master
and in
23 other branches
Fixed test: features/manage_products.feature
Showing
3 changed files
with
63 additions
and
72 deletions
Show diff stats
features/manage_products.feature
| ... | ... | @@ -13,7 +13,7 @@ Feature: manage products |
| 13 | 13 | |
| 14 | 14 | Scenario: display "create new product" button |
| 15 | 15 | Given I am logged in as "joaosilva" |
| 16 | - And I am on Rede Moinho's control panel | |
| 16 | + And I am on redemoinho's control panel | |
| 17 | 17 | When I follow "Manage Products and Services" |
| 18 | 18 | Then I should see "New product or service" |
| 19 | 19 | |
| ... | ... | @@ -34,7 +34,7 @@ Feature: manage products |
| 34 | 34 | | redemoinho | bicycle | Bike I | bicycle 9 | |
| 35 | 35 | | redemoinho | bicycle | Bike J | bicycle 10 | |
| 36 | 36 | | redemoinho | bicycle | Bike K | bicycle 11 | |
| 37 | - When I go to /catalog/redemoinho | |
| 37 | + When I go to redemoinho's products page | |
| 38 | 38 | Then I should see "Bike A" within "#product-list" |
| 39 | 39 | And I should see "Bike B" within "#product-list" |
| 40 | 40 | And I should see "Bike C" within "#product-list" |
| ... | ... | @@ -52,13 +52,13 @@ Feature: manage products |
| 52 | 52 | |
| 53 | 53 | Scenario: listing products and services |
| 54 | 54 | Given I am logged in as "joaosilva" |
| 55 | - And I am on Rede Moinho's control panel | |
| 55 | + And I am on redemoinho's control panel | |
| 56 | 56 | And I follow "Manage Products and Services" |
| 57 | 57 | Then I should see "Listing products and services" |
| 58 | 58 | |
| 59 | 59 | Scenario: see button to back in categories hierarchy |
| 60 | 60 | Given I am logged in as "joaosilva" |
| 61 | - And I am on Rede Moinho's control panel | |
| 61 | + And I am on redemoinho's control panel | |
| 62 | 62 | And I follow "Manage Products and Services" |
| 63 | 63 | When I follow "New product or service" |
| 64 | 64 | Then I should see "Back to the product listing" link |
| ... | ... | @@ -69,9 +69,7 @@ Feature: manage products |
| 69 | 69 | | Products | |
| 70 | 70 | | Services | |
| 71 | 71 | Given I am logged in as "joaosilva" |
| 72 | - And I am on Rede Moinho's control panel | |
| 73 | - And I follow "Manage Products and Services" | |
| 74 | - When I follow "New product or service" | |
| 72 | + And I go to redemoinho's new product page | |
| 75 | 73 | Then I should see "Products" |
| 76 | 74 | And I should see "Service" |
| 77 | 75 | |
| ... | ... | @@ -85,10 +83,8 @@ Feature: manage products |
| 85 | 83 | | Computers level1 | products-level0 | |
| 86 | 84 | | DVDs level1 | products-level0 | |
| 87 | 85 | Given I am logged in as "joaosilva" |
| 88 | - And I am on Rede Moinho's control panel | |
| 89 | - And I follow "Manage Products and Services" | |
| 90 | - When I follow "New product or service" | |
| 91 | - And I select "Products level0 »" and wait for jquery | |
| 86 | + And I go to redemoinho's new product page | |
| 87 | + And I select "Products level0 »" from "category_id" within "#categories_container_level0" | |
| 92 | 88 | Then I should see "Computers level1" |
| 93 | 89 | And I should see "DVDs level1" |
| 94 | 90 | |
| ... | ... | @@ -103,12 +99,12 @@ Feature: manage products |
| 103 | 99 | | Computers level1 | products-level0 | |
| 104 | 100 | | Software development level1 | services-level0 | |
| 105 | 101 | Given I am logged in as "joaosilva" |
| 106 | - And I am on Rede Moinho's control panel | |
| 107 | - And I follow "Manage Products and Services" | |
| 108 | - When I follow "New product or service" | |
| 109 | - And I select "Products level0 »" and wait for jquery | |
| 110 | - And I select "Computers level1" and wait for jquery | |
| 111 | - And I select "Services level0 »" and wait for jquery | |
| 102 | + And I go to redemoinho's new product page | |
| 103 | + And I should not see /Computers level/ | |
| 104 | + And I select "Products level0 »" from "category_id" within "#categories_container_wrapper" | |
| 105 | + And I should see /Computers level/ | |
| 106 | + And I should not see /Software develop/ | |
| 107 | + And I select "Services level0 »" from "category_id" within "#categories_container_wrapper" | |
| 112 | 108 | Then I should see /Software develop/ |
| 113 | 109 | And I should not see /Computers level/ |
| 114 | 110 | |
| ... | ... | @@ -121,11 +117,9 @@ Feature: manage products |
| 121 | 117 | | name | parent | |
| 122 | 118 | | Computers | products | |
| 123 | 119 | Given I am logged in as "joaosilva" |
| 124 | - And I am on Rede Moinho's control panel | |
| 125 | - And I follow "Manage Products and Services" | |
| 126 | - When I follow "New product or service" | |
| 127 | - And I select "Products »" and wait for jquery | |
| 128 | - And I select "Computers" and wait for jquery | |
| 120 | + And I go to redemoinho's new product page | |
| 121 | + And I select "Products »" from "category_id" within "#categories_container_level0" | |
| 122 | + And I select "Computers" from "category_id" within "#categories_container_level1" | |
| 129 | 123 | Then I should see "Products → Computers" |
| 130 | 124 | |
| 131 | 125 | @selenium |
| ... | ... | @@ -137,11 +131,9 @@ Feature: manage products |
| 137 | 131 | | name | parent | |
| 138 | 132 | | Category Level 1 | toplevel-product-categories | |
| 139 | 133 | Given I am logged in as "joaosilva" |
| 140 | - And I am on Rede Moinho's control panel | |
| 141 | - And I follow "Manage Products and Services" | |
| 142 | - When I follow "New product or service" | |
| 143 | - And I select "Toplevel Product Categories »" and wait for jquery | |
| 144 | - And I select "Category Level 1" and wait for jquery | |
| 134 | + And I go to redemoinho's new product page | |
| 135 | + And I select "Toplevel Product Categories »" from "category_id" within "#categories_container_level0" | |
| 136 | + And I select "Category Level 1" from "category_id" within "#categories_container_level1" | |
| 145 | 137 | Then I should see "Toplevel Product Categories" link |
| 146 | 138 | And I should not see "Category Level 1" link |
| 147 | 139 | |
| ... | ... | @@ -151,8 +143,8 @@ Feature: manage products |
| 151 | 143 | | name | |
| 152 | 144 | | Only for test | |
| 153 | 145 | And I am logged in as "joaosilva" |
| 154 | - When I go to /myprofile/redemoinho/manage_products/new | |
| 155 | - Then the "#save_and_continue" button should not be enabled | |
| 146 | + When I go to redemoinho's new product page | |
| 147 | + Then the "#save_and_continue" button should be disabled | |
| 156 | 148 | |
| 157 | 149 | @selenium |
| 158 | 150 | Scenario: enable save button when select one category |
| ... | ... | @@ -160,11 +152,9 @@ Feature: manage products |
| 160 | 152 | And the following product_category |
| 161 | 153 | | name | |
| 162 | 154 | | Browsers (accept categories) | |
| 163 | - And I am on Rede Moinho's control panel | |
| 164 | - And I follow "Manage Products and Services" | |
| 165 | - When I follow "New product or service" | |
| 166 | - And I select "Browsers (accept categories)" and wait for jquery | |
| 167 | - Then the "Save and continue" button should be enabled | |
| 155 | + When I go to redemoinho's new product page | |
| 156 | + And I select "Browsers (accept categories)" from "category_id" within "#categories_container_wrapper" | |
| 157 | + Then the "#save_and_continue" button should be enabled | |
| 168 | 158 | |
| 169 | 159 | @selenium |
| 170 | 160 | Scenario: dont enable save button when select category with not accept products |
| ... | ... | @@ -172,11 +162,9 @@ Feature: manage products |
| 172 | 162 | | name | accept_products | |
| 173 | 163 | | Browsers | false | |
| 174 | 164 | Given I am logged in as "joaosilva" |
| 175 | - And I am on Rede Moinho's control panel | |
| 176 | - And I follow "Manage Products and Services" | |
| 177 | - When I follow "New product or service" | |
| 178 | - And I select "Browsers" and wait for jquery | |
| 179 | - Then the "#save_and_continue" button should not be enabled | |
| 165 | + When I go to redemoinho's new product page | |
| 166 | + And I select "Browsers" from "category_id" within "#categories_container_wrapper" | |
| 167 | + Then the "#save_and_continue" button should be disabled | |
| 180 | 168 | |
| 181 | 169 | @selenium |
| 182 | 170 | Scenario: save product |
| ... | ... | @@ -184,32 +172,14 @@ Feature: manage products |
| 184 | 172 | | name | |
| 185 | 173 | | Bicycle | |
| 186 | 174 | Given I am logged in as "joaosilva" |
| 187 | - And I am on Rede Moinho's control panel | |
| 188 | - And I follow "Manage Products and Services" | |
| 189 | - When I follow "New product or service" | |
| 190 | - And I select "Bicycle" and wait for jquery | |
| 175 | + When I go to redemoinho's new product page | |
| 176 | + And I select "Bicycle" from "category_id" within "#categories_container_wrapper" | |
| 191 | 177 | And I press "Save and continue" |
| 192 | - Then I should see "Bicycle" | |
| 178 | + When I go to redemoinho's products page | |
| 179 | + And I follow "Bicycle" within "#product-list" | |
| 180 | + Then I should see "Bicycle" within "#show_product" | |
| 193 | 181 | And I should see "Change category" |
| 194 | 182 | |
| 195 | - @selenium | |
| 196 | - Scenario: stay on the same place after error on save | |
| 197 | - Given the following product_category | |
| 198 | - | name | | |
| 199 | - | Bicycle | | |
| 200 | - Given I am logged in as "joaosilva" | |
| 201 | - And I am on Rede Moinho's control panel | |
| 202 | - And I follow "Manage Products and Services" | |
| 203 | - And I follow "New product or service" | |
| 204 | - And I select "Bicycle" and wait for jquery | |
| 205 | - And I press "Save and continue" | |
| 206 | - When I follow "Back" | |
| 207 | - And I follow "New product or service" | |
| 208 | - And I select "Bicycle" and wait for jquery | |
| 209 | - And I press "Save and continue" | |
| 210 | - Then I should be on Rede Moinho's new product page | |
| 211 | - And I should see "Bicycle" | |
| 212 | - | |
| 213 | 183 | Scenario: a user with permission can see edit links |
| 214 | 184 | Given the following product_category |
| 215 | 185 | | name | |
| ... | ... | @@ -331,10 +301,11 @@ Feature: manage products |
| 331 | 301 | And I am logged in as "joaosilva" |
| 332 | 302 | When I go to Rede Moinho's page of product Generic pc |
| 333 | 303 | And I follow "Change category" |
| 334 | - And I select "Eletronics »" and wait for jquery | |
| 335 | - Then I select "DVDs" and wait for jquery | |
| 304 | + And I select "Eletronics »" from "category_id" within "#categories_container_level0" | |
| 305 | + Then I select "DVDs" from "category_id" within "#categories_container_level1" | |
| 336 | 306 | And I press "Save and continue" |
| 337 | - Then I should see "Eletronics → DVDs" | |
| 307 | + When I go to Rede Moinho's page of product Generic pc | |
| 308 | + Then I should see "Eletronics → DVDs" within ".hierarchy-category" | |
| 338 | 309 | |
| 339 | 310 | @selenium |
| 340 | 311 | Scenario: cancel edition of a product category |
| ... | ... | @@ -424,7 +395,9 @@ Feature: manage products |
| 424 | 395 | And I follow "Change category" |
| 425 | 396 | And I press "Save and continue" |
| 426 | 397 | Then I should not see "Product category can't be blank" |
| 427 | - And I should be on Rede Moinho's page of product Generic pc | |
| 398 | + When I go to Rede Moinho's page of product Generic pc | |
| 399 | + Then I should see "Eletronics → Computers" within ".hierarchy-category" | |
| 400 | + | |
| 428 | 401 | And I should see "Generic pc" |
| 429 | 402 | |
| 430 | 403 | @selenium |
| ... | ... | @@ -450,7 +423,7 @@ Feature: manage products |
| 450 | 423 | And I am logged in as "joaosilva" |
| 451 | 424 | When I go to Rede Moinho's page of product Generic pc |
| 452 | 425 | And I follow "Change category" |
| 453 | - Then the select for category "Netbook from Venus" should be visible | |
| 426 | + Then "Netbook from Venus" should be visible within "#categories_container_wrapper" | |
| 454 | 427 | |
| 455 | 428 | @selenium |
| 456 | 429 | Scenario: Truncate long category name in selection of category |
| ... | ... | @@ -462,7 +435,7 @@ Feature: manage products |
| 462 | 435 | | name | parent | |
| 463 | 436 | | Netbook Quantum | Super Quantum Computers with teraflops | |
| 464 | 437 | And I am logged in as "joaosilva" |
| 465 | - When I go to Rede Moinho's new product page | |
| 438 | + When I go to redemoinho's new product page | |
| 466 | 439 | Then I should see "Nanonote nanotech with long lo..." |
| 467 | 440 | And I should see "Super Quantum Computers with t... »" |
| 468 | 441 | |
| ... | ... | @@ -481,7 +454,7 @@ Feature: manage products |
| 481 | 454 | When I go to Rede Moinho's page of product Bike |
| 482 | 455 | And I follow "Edit name and unit" |
| 483 | 456 | And I fill in "Red bicycle" for "product_name" |
| 484 | - And I select "Kilo" | |
| 457 | + And I select "Kilo" from "product_unit_id" within "#product-name-form" | |
| 485 | 458 | And I press "Save" |
| 486 | 459 | Then I should see "Red bicycle - kilo" |
| 487 | 460 | |
| ... | ... | @@ -519,12 +492,14 @@ Feature: manage products |
| 519 | 492 | When I go to Rede Moinho's page of product Bike |
| 520 | 493 | And I follow "Add price and other basic information" |
| 521 | 494 | And I follow "Add new qualifier" |
| 522 | - And I select "Organic" and wait for jquery | |
| 495 | + And I select "Organic" from "selected_qualifier" within "#product-qualifiers-list" | |
| 523 | 496 | And I press "Save" |
| 497 | + And I go to Rede Moinho's page of product Bike | |
| 524 | 498 | Then I should see "Organic (Self declared)" |
| 525 | 499 | When I follow "Edit basic information" |
| 526 | 500 | And I follow "Delete qualifier" |
| 527 | 501 | And I press "Save" |
| 502 | + And I go to Rede Moinho's page of product Bike | |
| 528 | 503 | Then I should not see "Organic (Self declared)" |
| 529 | 504 | |
| 530 | 505 | @selenium | ... | ... |
features/step_definitions/custom_web_steps.rb
| ... | ... | @@ -4,6 +4,12 @@ Then /^"([^"]*)" should not be visible within "([^"]*)"$/ do |text, selector| |
| 4 | 4 | end |
| 5 | 5 | end |
| 6 | 6 | |
| 7 | +Then /^"([^"]*)" should be visible within "([^"]*)"$/ do |text, selector| | |
| 8 | + if page.has_content?(text) | |
| 9 | + page.should have_css(selector, :text => text, :visible => false) | |
| 10 | + end | |
| 11 | +end | |
| 12 | + | |
| 7 | 13 | Then /^I should see "([^"]*)" link$/ do |text| |
| 8 | 14 | page.should have_css('a', :text => text) |
| 9 | 15 | end |
| ... | ... | @@ -16,6 +22,16 @@ When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| |
| 16 | 22 | page.should have_xpath("//a", :href => /#{href}/) |
| 17 | 23 | end |
| 18 | 24 | |
| 25 | +Then /^the "([^"]*)" button should be disabled$/ do |selector| | |
| 26 | + field = find(selector) | |
| 27 | + field['disabled'].should be_true | |
| 28 | +end | |
| 29 | + | |
| 30 | +Then /^the "([^"]*)" button should be enabled$/ do |selector| | |
| 31 | + field = find(selector) | |
| 32 | + field['disabled'].should_not be_true | |
| 33 | +end | |
| 34 | + | |
| 19 | 35 | When /^I reload and wait for the page$/ do |
| 20 | 36 | raise "Why why need this? Remove!" |
| 21 | 37 | visit page.driver.browser.current_url | ... | ... |
features/support/paths.rb
| ... | ... | @@ -89,7 +89,7 @@ module NavigationHelpers |
| 89 | 89 | '/myprofile/%s/profile_members' % Profile.find_by_name($1).identifier |
| 90 | 90 | |
| 91 | 91 | when /^(.+)'s new product page/ |
| 92 | - '/myprofile/%s/manage_products/new' % Profile.find_by_name($1).identifier | |
| 92 | + '/myprofile/%s/manage_products/new' % $1 | |
| 93 | 93 | |
| 94 | 94 | when /^(.+)'s page of product (.*)$/ |
| 95 | 95 | enterprise = Profile.find_by_name($1) |
| ... | ... | @@ -97,7 +97,7 @@ module NavigationHelpers |
| 97 | 97 | '/myprofile/%s/manage_products/show/%s' % [enterprise.identifier, product.id] |
| 98 | 98 | |
| 99 | 99 | when /^(.*)'s products page$/ |
| 100 | - '/catalog/%s' % Profile.find_by_name($1).identifier | |
| 100 | + '/catalog/%s' % $1 | |
| 101 | 101 | |
| 102 | 102 | when /^chat$/ |
| 103 | 103 | '/chat' | ... | ... |