Commit 43d5b90abf034199d6a0dd4a8982cc9013d41020

Authored by Daniela Feitosa
1 parent db09f4dc

Fixed test: features/search_products.feature

features/search_products.feature
... ... @@ -21,14 +21,18 @@ Feature: search products
21 21 When I go to the search products page
22 22 Then I should see "wikis consultancy" within "#search-results"
23 23 And I should see "social networks consultancy" within "#search-results"
24   - And I should not see content inside "div.pagination"
25   - And I should not see content inside "#facets-menu"
  24 +
  25 + Scenario: not show pagination and facets on recent products
  26 + When I go to the search products page
  27 + Then The page should not contain "div.pagination"
  28 + And The page should not contain "#facets-menu"
26 29  
27 30 Scenario: show empty search results
28 31 When I search products for "something unrelated"
29 32 Then I should see "None" within ".search-results-type-empty"
30 33  
31 34 Scenario: simple search for product
  35 + Given there are no pending jobs
32 36 When I search products for "wikis"
33 37 Then I should see "wikis consultancy" within "#search-results"
34 38 And I should see "wikis consultancy" within ".only-one-result-box"
... ... @@ -38,7 +42,7 @@ Feature: search products
38 42  
39 43 Scenario: see default facets when searching
40 44 When I go to the search products page
41   - And I fill in "query" with "wikis"
  45 + And I fill in "search-input" with "wikis"
42 46 And I press "Search"
43 47 Then I should see "Related products" within "#facets-menu"
44 48 Then I should see "City" within "#facets-menu"
... ... @@ -49,7 +53,7 @@ Feature: search products
49 53 | product | category | solidary |
50 54 | wikis consultancy | development | true |
51 55 When I go to the search products page
52   - And I fill in "query" with "wikis"
  56 + And I fill in "search-input" with "wikis"
53 57 And I press "Search"
54 58 Then I should see "100%" within "div.search-product-ecosol-percentage-icon-100"
55 59  
... ... @@ -59,7 +63,7 @@ Feature: search products
59 63 | wikis consultancy | development | true |
60 64 | wikis consultancy | development | false |
61 65 When I go to the search products page
62   - And I fill in "query" with "wikis"
  66 + And I fill in "search-input" with "wikis"
63 67 And I press "Search"
64 68 Then I should see "50%" within "div.search-product-ecosol-percentage-icon-50"
65 69  
... ... @@ -71,7 +75,7 @@ Feature: search products
71 75 | wikis consultancy | development | true |
72 76 | wikis consultancy | development | false |
73 77 When I go to the search products page
74   - And I fill in "query" with "wikis"
  78 + And I fill in "search-input" with "wikis"
75 79 And I press "Search"
76 80 Then I should see "75%" within "div.search-product-ecosol-percentage-icon-75"
77 81  
... ... @@ -83,7 +87,7 @@ Feature: search products
83 87 | wikis consultancy | development | false |
84 88 | wikis consultancy | development | false |
85 89 When I go to the search products page
86   - And I fill in "query" with "wikis"
  90 + And I fill in "search-input" with "wikis"
87 91 And I press "Search"
88 92 Then I should see "25%" within "div.search-product-ecosol-percentage-icon-25"
89 93  
... ... @@ -92,7 +96,7 @@ Feature: search products
92 96 | owner | category | name | price | img |
93 97 | colivre-ent | development | noosfero | 12.34 | noosfero-network |
94 98 When I go to the search products page
95   - And I fill in "query" with "noosfero"
  99 + And I fill in "search-input" with "noosfero"
96 100 And I press "Search"
97 101 Then I should not see "No image"
98 102 And I should see "Zoom in" within "a.zoomify-image"
... ... @@ -105,7 +109,7 @@ Feature: search products
105 109 | owner | name | category |
106 110 | colivre-ent | Noosfero | software-livre |
107 111 When I go to the search products page
108   - And I fill in "query" with "software livre"
  112 + And I fill in "search-input" with "software livre"
109 113 And I press "Search"
110 114 Then I should see "Noosfero" within "#search-results"
111 115 And I should not see "wikis consultancy"
... ... @@ -125,7 +129,7 @@ Feature: search products
125 129 | owner | name | category |
126 130 | art-pp | Arte em Madeira | solidaria |
127 131 When I go to the search products page
128   - And I fill in "query" with "Madeira"
  132 + And I fill in "search-input" with "Madeira"
129 133 And I press "Search"
130 134 Then I should see "Pres. Prudente" within "#facet-menu-f_region"
131 135 And I should see ", SP" within "#facet-menu-f_region"
... ... @@ -145,7 +149,7 @@ Feature: search products
145 149 | owner | name | category |
146 150 | art-pp | Arte em Madeira | solidaria |
147 151 When I go to the search products page
148   - And I fill in "query" with "Prudente"
  152 + And I fill in "search-input" with "Prudente"
149 153 And I press "Search"
150 154 Then I should see "Arte em Madeira" within "#search-results"
151 155  
... ... @@ -157,7 +161,7 @@ Feature: search products
157 161 | owner | name | category |
158 162 | colivre-ent | Noosfero Social Network Platform | software-livre |
159 163 When I go to the search products page
160   - And I fill in "query" with "Noosfero Network"
  164 + And I fill in "search-input" with "Noosfero Network"
161 165 And I press "Search"
162 166 Then I should see "Noosfero Social Network Platform" within "#search-results"
163 167  
... ... @@ -177,7 +181,7 @@ Feature: search products
177 181 | colivre-ent | Noosfero Network | software-livre |
178 182 | fb | Facebook Network | big-brother |
179 183 When I go to the search products page
180   - And I fill in "query" with "Network"
  184 + And I fill in "search-input" with "Network"
181 185 And I press "Search"
182 186 And I follow "Software Livre" within "#facets-menu"
183 187 Then I should see "Noosfero Network" within "#search-results"
... ... @@ -206,10 +210,10 @@ Feature: search products
206 210 | other | Other open | software-livre |
207 211 | other | Other closed | big-brother |
208 212 When I go to the search products page
209   - And I fill in "query" with "Network"
  213 + And I fill in "search-input" with "Network"
210 214 And I press "Search"
211 215 And I follow "Software Livre" within "#facets-menu"
212   - And I fill in "query" with "Other"
  216 + And I fill in "search-input" with "Other"
213 217 And I press "Search"
214 218 Then I should see "Other open" within "#search-results"
215 219 And I should not see "Other closed"
... ... @@ -217,4 +221,4 @@ Feature: search products
217 221 Scenario: don't search when products are disabled in environment
218 222 Given feature "disable_asset_products" is enabled on environment
219 223 When I go to the search products page
220   - Then I should not see content inside "#search-results"
  224 + Then I should see "There is no such page" within "#not-found"
... ...
features/step_definitions/invitation_steps.rb
... ... @@ -17,9 +17,3 @@ Given /^I invite email "(.+)" to be my friend$/ do |email|
17 17 fill_in('mail_template', :with => 'Follow this link <url>')
18 18 click_button("Invite my friends!")
19 19 end
20   -
21   -Given /^there are no pending jobs$/ do
22   - silence_stream(STDOUT) do
23   - Delayed::Worker.new.work_off
24   - end
25   -end
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -422,6 +422,10 @@ Then /^The page title should contain &quot;(.*)&quot;$/ do |text|
422 422 end
423 423 end
424 424  
  425 +Then /^The page should not contain "(.*)"$/ do |selector|
  426 + page.should have_no_css("#{selector}")
  427 +end
  428 +
425 429 Given /^the mailbox is empty$/ do
426 430 ActionMailer::Base.deliveries = []
427 431 end
... ... @@ -647,20 +651,26 @@ end
647 651  
648 652 When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query|
649 653 When %{I go to the search #{asset} page}
650   - And %{I fill in "query" with "#{query}"}
  654 + And %{I fill in "search-input" with "#{query}"}
651 655 And %{I press "Search"}
652 656 end
653 657  
654 658 Then /^I should see ([^\"]*)'s product image$/ do |product_name|
655 659 p = Product.find_by_name product_name
656   - path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p, :only_path => true))
657   - response.should have_selector("div[class~=\"zoomable-image\"] a[href=\"http://#{path}\"]")
  660 + path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p))
  661 +
  662 + with_scope('.zoomable-image') do
  663 + page.should have_xpath("a[@href=\"#{path}\"][@class='search-image-pic']")
  664 + end
658 665 end
659 666  
660 667 Then /^I should not see ([^\"]*)'s product image$/ do |product_name|
661 668 p = Product.find_by_name product_name
662   - path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p, :only_path => true))
663   - response.should_not have_selector("div[class~=\"zoomable-image\"] a[href=\"http://#{path}\"]")
  669 + path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p))
  670 +
  671 + with_scope('.zoomable-image') do
  672 + page.should have_no_xpath("a[@href=\"#{path}\"][@class='search-image-pic']")
  673 + end
664 674 end
665 675  
666 676 Then /^I should see ([^\"]*)'s profile image$/ do |name|
... ... @@ -738,3 +748,9 @@ Given /^the profile (.*) is configured to (.*) after login$/ do |profile, option
738 748 profile.redirection_after_login = redirection
739 749 profile.save
740 750 end
  751 +
  752 +Given /^there are no pending jobs$/ do
  753 + silence_stream(STDOUT) do
  754 + Delayed::Worker.new.work_off
  755 + end
  756 +end
... ...