Commit 37105a381e9e67c70204221962faa3ac5bd7d5e0
1 parent
972a12ab
Exists in
staging
and in
42 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,7 +13,7 @@ Feature: manage products | ||
| 13 | 13 | ||
| 14 | Scenario: display "create new product" button | 14 | Scenario: display "create new product" button |
| 15 | Given I am logged in as "joaosilva" | 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 | When I follow "Manage Products and Services" | 17 | When I follow "Manage Products and Services" |
| 18 | Then I should see "New product or service" | 18 | Then I should see "New product or service" |
| 19 | 19 | ||
| @@ -34,7 +34,7 @@ Feature: manage products | @@ -34,7 +34,7 @@ Feature: manage products | ||
| 34 | | redemoinho | bicycle | Bike I | bicycle 9 | | 34 | | redemoinho | bicycle | Bike I | bicycle 9 | |
| 35 | | redemoinho | bicycle | Bike J | bicycle 10 | | 35 | | redemoinho | bicycle | Bike J | bicycle 10 | |
| 36 | | redemoinho | bicycle | Bike K | bicycle 11 | | 36 | | redemoinho | bicycle | Bike K | bicycle 11 | |
| 37 | - When I go to /catalog/redemoinho | 37 | + When I go to redemoinho's products page |
| 38 | Then I should see "Bike A" within "#product-list" | 38 | Then I should see "Bike A" within "#product-list" |
| 39 | And I should see "Bike B" within "#product-list" | 39 | And I should see "Bike B" within "#product-list" |
| 40 | And I should see "Bike C" within "#product-list" | 40 | And I should see "Bike C" within "#product-list" |
| @@ -52,13 +52,13 @@ Feature: manage products | @@ -52,13 +52,13 @@ Feature: manage products | ||
| 52 | 52 | ||
| 53 | Scenario: listing products and services | 53 | Scenario: listing products and services |
| 54 | Given I am logged in as "joaosilva" | 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 | And I follow "Manage Products and Services" | 56 | And I follow "Manage Products and Services" |
| 57 | Then I should see "Listing products and services" | 57 | Then I should see "Listing products and services" |
| 58 | 58 | ||
| 59 | Scenario: see button to back in categories hierarchy | 59 | Scenario: see button to back in categories hierarchy |
| 60 | Given I am logged in as "joaosilva" | 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 | And I follow "Manage Products and Services" | 62 | And I follow "Manage Products and Services" |
| 63 | When I follow "New product or service" | 63 | When I follow "New product or service" |
| 64 | Then I should see "Back to the product listing" link | 64 | Then I should see "Back to the product listing" link |
| @@ -69,9 +69,7 @@ Feature: manage products | @@ -69,9 +69,7 @@ Feature: manage products | ||
| 69 | | Products | | 69 | | Products | |
| 70 | | Services | | 70 | | Services | |
| 71 | Given I am logged in as "joaosilva" | 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 | Then I should see "Products" | 73 | Then I should see "Products" |
| 76 | And I should see "Service" | 74 | And I should see "Service" |
| 77 | 75 | ||
| @@ -85,10 +83,8 @@ Feature: manage products | @@ -85,10 +83,8 @@ Feature: manage products | ||
| 85 | | Computers level1 | products-level0 | | 83 | | Computers level1 | products-level0 | |
| 86 | | DVDs level1 | products-level0 | | 84 | | DVDs level1 | products-level0 | |
| 87 | Given I am logged in as "joaosilva" | 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 | Then I should see "Computers level1" | 88 | Then I should see "Computers level1" |
| 93 | And I should see "DVDs level1" | 89 | And I should see "DVDs level1" |
| 94 | 90 | ||
| @@ -103,12 +99,12 @@ Feature: manage products | @@ -103,12 +99,12 @@ Feature: manage products | ||
| 103 | | Computers level1 | products-level0 | | 99 | | Computers level1 | products-level0 | |
| 104 | | Software development level1 | services-level0 | | 100 | | Software development level1 | services-level0 | |
| 105 | Given I am logged in as "joaosilva" | 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 | Then I should see /Software develop/ | 108 | Then I should see /Software develop/ |
| 113 | And I should not see /Computers level/ | 109 | And I should not see /Computers level/ |
| 114 | 110 | ||
| @@ -121,11 +117,9 @@ Feature: manage products | @@ -121,11 +117,9 @@ Feature: manage products | ||
| 121 | | name | parent | | 117 | | name | parent | |
| 122 | | Computers | products | | 118 | | Computers | products | |
| 123 | Given I am logged in as "joaosilva" | 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 | Then I should see "Products → Computers" | 123 | Then I should see "Products → Computers" |
| 130 | 124 | ||
| 131 | @selenium | 125 | @selenium |
| @@ -137,11 +131,9 @@ Feature: manage products | @@ -137,11 +131,9 @@ Feature: manage products | ||
| 137 | | name | parent | | 131 | | name | parent | |
| 138 | | Category Level 1 | toplevel-product-categories | | 132 | | Category Level 1 | toplevel-product-categories | |
| 139 | Given I am logged in as "joaosilva" | 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 | Then I should see "Toplevel Product Categories" link | 137 | Then I should see "Toplevel Product Categories" link |
| 146 | And I should not see "Category Level 1" link | 138 | And I should not see "Category Level 1" link |
| 147 | 139 | ||
| @@ -151,8 +143,8 @@ Feature: manage products | @@ -151,8 +143,8 @@ Feature: manage products | ||
| 151 | | name | | 143 | | name | |
| 152 | | Only for test | | 144 | | Only for test | |
| 153 | And I am logged in as "joaosilva" | 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 | @selenium | 149 | @selenium |
| 158 | Scenario: enable save button when select one category | 150 | Scenario: enable save button when select one category |
| @@ -160,11 +152,9 @@ Feature: manage products | @@ -160,11 +152,9 @@ Feature: manage products | ||
| 160 | And the following product_category | 152 | And the following product_category |
| 161 | | name | | 153 | | name | |
| 162 | | Browsers (accept categories) | | 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 | @selenium | 159 | @selenium |
| 170 | Scenario: dont enable save button when select category with not accept products | 160 | Scenario: dont enable save button when select category with not accept products |
| @@ -172,11 +162,9 @@ Feature: manage products | @@ -172,11 +162,9 @@ Feature: manage products | ||
| 172 | | name | accept_products | | 162 | | name | accept_products | |
| 173 | | Browsers | false | | 163 | | Browsers | false | |
| 174 | Given I am logged in as "joaosilva" | 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 | @selenium | 169 | @selenium |
| 182 | Scenario: save product | 170 | Scenario: save product |
| @@ -184,32 +172,14 @@ Feature: manage products | @@ -184,32 +172,14 @@ Feature: manage products | ||
| 184 | | name | | 172 | | name | |
| 185 | | Bicycle | | 173 | | Bicycle | |
| 186 | Given I am logged in as "joaosilva" | 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 | And I press "Save and continue" | 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 | And I should see "Change category" | 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 | Scenario: a user with permission can see edit links | 183 | Scenario: a user with permission can see edit links |
| 214 | Given the following product_category | 184 | Given the following product_category |
| 215 | | name | | 185 | | name | |
| @@ -331,10 +301,11 @@ Feature: manage products | @@ -331,10 +301,11 @@ Feature: manage products | ||
| 331 | And I am logged in as "joaosilva" | 301 | And I am logged in as "joaosilva" |
| 332 | When I go to Rede Moinho's page of product Generic pc | 302 | When I go to Rede Moinho's page of product Generic pc |
| 333 | And I follow "Change category" | 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 | And I press "Save and continue" | 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 | @selenium | 310 | @selenium |
| 340 | Scenario: cancel edition of a product category | 311 | Scenario: cancel edition of a product category |
| @@ -424,7 +395,9 @@ Feature: manage products | @@ -424,7 +395,9 @@ Feature: manage products | ||
| 424 | And I follow "Change category" | 395 | And I follow "Change category" |
| 425 | And I press "Save and continue" | 396 | And I press "Save and continue" |
| 426 | Then I should not see "Product category can't be blank" | 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 | And I should see "Generic pc" | 401 | And I should see "Generic pc" |
| 429 | 402 | ||
| 430 | @selenium | 403 | @selenium |
| @@ -450,7 +423,7 @@ Feature: manage products | @@ -450,7 +423,7 @@ Feature: manage products | ||
| 450 | And I am logged in as "joaosilva" | 423 | And I am logged in as "joaosilva" |
| 451 | When I go to Rede Moinho's page of product Generic pc | 424 | When I go to Rede Moinho's page of product Generic pc |
| 452 | And I follow "Change category" | 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 | @selenium | 428 | @selenium |
| 456 | Scenario: Truncate long category name in selection of category | 429 | Scenario: Truncate long category name in selection of category |
| @@ -462,7 +435,7 @@ Feature: manage products | @@ -462,7 +435,7 @@ Feature: manage products | ||
| 462 | | name | parent | | 435 | | name | parent | |
| 463 | | Netbook Quantum | Super Quantum Computers with teraflops | | 436 | | Netbook Quantum | Super Quantum Computers with teraflops | |
| 464 | And I am logged in as "joaosilva" | 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 | Then I should see "Nanonote nanotech with long lo..." | 439 | Then I should see "Nanonote nanotech with long lo..." |
| 467 | And I should see "Super Quantum Computers with t... »" | 440 | And I should see "Super Quantum Computers with t... »" |
| 468 | 441 | ||
| @@ -481,7 +454,7 @@ Feature: manage products | @@ -481,7 +454,7 @@ Feature: manage products | ||
| 481 | When I go to Rede Moinho's page of product Bike | 454 | When I go to Rede Moinho's page of product Bike |
| 482 | And I follow "Edit name and unit" | 455 | And I follow "Edit name and unit" |
| 483 | And I fill in "Red bicycle" for "product_name" | 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 | And I press "Save" | 458 | And I press "Save" |
| 486 | Then I should see "Red bicycle - kilo" | 459 | Then I should see "Red bicycle - kilo" |
| 487 | 460 | ||
| @@ -519,12 +492,14 @@ Feature: manage products | @@ -519,12 +492,14 @@ Feature: manage products | ||
| 519 | When I go to Rede Moinho's page of product Bike | 492 | When I go to Rede Moinho's page of product Bike |
| 520 | And I follow "Add price and other basic information" | 493 | And I follow "Add price and other basic information" |
| 521 | And I follow "Add new qualifier" | 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 | And I press "Save" | 496 | And I press "Save" |
| 497 | + And I go to Rede Moinho's page of product Bike | ||
| 524 | Then I should see "Organic (Self declared)" | 498 | Then I should see "Organic (Self declared)" |
| 525 | When I follow "Edit basic information" | 499 | When I follow "Edit basic information" |
| 526 | And I follow "Delete qualifier" | 500 | And I follow "Delete qualifier" |
| 527 | And I press "Save" | 501 | And I press "Save" |
| 502 | + And I go to Rede Moinho's page of product Bike | ||
| 528 | Then I should not see "Organic (Self declared)" | 503 | Then I should not see "Organic (Self declared)" |
| 529 | 504 | ||
| 530 | @selenium | 505 | @selenium |
features/step_definitions/custom_web_steps.rb
| @@ -4,6 +4,12 @@ Then /^"([^"]*)" should not be visible within "([^"]*)"$/ do |text, selector| | @@ -4,6 +4,12 @@ Then /^"([^"]*)" should not be visible within "([^"]*)"$/ do |text, selector| | ||
| 4 | end | 4 | end |
| 5 | end | 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 | Then /^I should see "([^"]*)" link$/ do |text| | 13 | Then /^I should see "([^"]*)" link$/ do |text| |
| 8 | page.should have_css('a', :text => text) | 14 | page.should have_css('a', :text => text) |
| 9 | end | 15 | end |
| @@ -16,6 +22,16 @@ When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| | @@ -16,6 +22,16 @@ When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| | ||
| 16 | page.should have_xpath("//a", :href => /#{href}/) | 22 | page.should have_xpath("//a", :href => /#{href}/) |
| 17 | end | 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 | When /^I reload and wait for the page$/ do | 35 | When /^I reload and wait for the page$/ do |
| 20 | raise "Why why need this? Remove!" | 36 | raise "Why why need this? Remove!" |
| 21 | visit page.driver.browser.current_url | 37 | visit page.driver.browser.current_url |
features/support/paths.rb
| @@ -89,7 +89,7 @@ module NavigationHelpers | @@ -89,7 +89,7 @@ module NavigationHelpers | ||
| 89 | '/myprofile/%s/profile_members' % Profile.find_by_name($1).identifier | 89 | '/myprofile/%s/profile_members' % Profile.find_by_name($1).identifier |
| 90 | 90 | ||
| 91 | when /^(.+)'s new product page/ | 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 | when /^(.+)'s page of product (.*)$/ | 94 | when /^(.+)'s page of product (.*)$/ |
| 95 | enterprise = Profile.find_by_name($1) | 95 | enterprise = Profile.find_by_name($1) |
| @@ -97,7 +97,7 @@ module NavigationHelpers | @@ -97,7 +97,7 @@ module NavigationHelpers | ||
| 97 | '/myprofile/%s/manage_products/show/%s' % [enterprise.identifier, product.id] | 97 | '/myprofile/%s/manage_products/show/%s' % [enterprise.identifier, product.id] |
| 98 | 98 | ||
| 99 | when /^(.*)'s products page$/ | 99 | when /^(.*)'s products page$/ |
| 100 | - '/catalog/%s' % Profile.find_by_name($1).identifier | 100 | + '/catalog/%s' % $1 |
| 101 | 101 | ||
| 102 | when /^chat$/ | 102 | when /^chat$/ |
| 103 | '/chat' | 103 | '/chat' |