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,14 +21,18 @@ Feature: search products
21 When I go to the search products page 21 When I go to the search products page
22 Then I should see "wikis consultancy" within "#search-results" 22 Then I should see "wikis consultancy" within "#search-results"
23 And I should see "social networks consultancy" within "#search-results" 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 Scenario: show empty search results 30 Scenario: show empty search results
28 When I search products for "something unrelated" 31 When I search products for "something unrelated"
29 Then I should see "None" within ".search-results-type-empty" 32 Then I should see "None" within ".search-results-type-empty"
30 33
31 Scenario: simple search for product 34 Scenario: simple search for product
  35 + Given there are no pending jobs
32 When I search products for "wikis" 36 When I search products for "wikis"
33 Then I should see "wikis consultancy" within "#search-results" 37 Then I should see "wikis consultancy" within "#search-results"
34 And I should see "wikis consultancy" within ".only-one-result-box" 38 And I should see "wikis consultancy" within ".only-one-result-box"
@@ -38,7 +42,7 @@ Feature: search products @@ -38,7 +42,7 @@ Feature: search products
38 42
39 Scenario: see default facets when searching 43 Scenario: see default facets when searching
40 When I go to the search products page 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 And I press "Search" 46 And I press "Search"
43 Then I should see "Related products" within "#facets-menu" 47 Then I should see "Related products" within "#facets-menu"
44 Then I should see "City" within "#facets-menu" 48 Then I should see "City" within "#facets-menu"
@@ -49,7 +53,7 @@ Feature: search products @@ -49,7 +53,7 @@ Feature: search products
49 | product | category | solidary | 53 | product | category | solidary |
50 | wikis consultancy | development | true | 54 | wikis consultancy | development | true |
51 When I go to the search products page 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 And I press "Search" 57 And I press "Search"
54 Then I should see "100%" within "div.search-product-ecosol-percentage-icon-100" 58 Then I should see "100%" within "div.search-product-ecosol-percentage-icon-100"
55 59
@@ -59,7 +63,7 @@ Feature: search products @@ -59,7 +63,7 @@ Feature: search products
59 | wikis consultancy | development | true | 63 | wikis consultancy | development | true |
60 | wikis consultancy | development | false | 64 | wikis consultancy | development | false |
61 When I go to the search products page 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 And I press "Search" 67 And I press "Search"
64 Then I should see "50%" within "div.search-product-ecosol-percentage-icon-50" 68 Then I should see "50%" within "div.search-product-ecosol-percentage-icon-50"
65 69
@@ -71,7 +75,7 @@ Feature: search products @@ -71,7 +75,7 @@ Feature: search products
71 | wikis consultancy | development | true | 75 | wikis consultancy | development | true |
72 | wikis consultancy | development | false | 76 | wikis consultancy | development | false |
73 When I go to the search products page 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 And I press "Search" 79 And I press "Search"
76 Then I should see "75%" within "div.search-product-ecosol-percentage-icon-75" 80 Then I should see "75%" within "div.search-product-ecosol-percentage-icon-75"
77 81
@@ -83,7 +87,7 @@ Feature: search products @@ -83,7 +87,7 @@ Feature: search products
83 | wikis consultancy | development | false | 87 | wikis consultancy | development | false |
84 | wikis consultancy | development | false | 88 | wikis consultancy | development | false |
85 When I go to the search products page 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 And I press "Search" 91 And I press "Search"
88 Then I should see "25%" within "div.search-product-ecosol-percentage-icon-25" 92 Then I should see "25%" within "div.search-product-ecosol-percentage-icon-25"
89 93
@@ -92,7 +96,7 @@ Feature: search products @@ -92,7 +96,7 @@ Feature: search products
92 | owner | category | name | price | img | 96 | owner | category | name | price | img |
93 | colivre-ent | development | noosfero | 12.34 | noosfero-network | 97 | colivre-ent | development | noosfero | 12.34 | noosfero-network |
94 When I go to the search products page 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 And I press "Search" 100 And I press "Search"
97 Then I should not see "No image" 101 Then I should not see "No image"
98 And I should see "Zoom in" within "a.zoomify-image" 102 And I should see "Zoom in" within "a.zoomify-image"
@@ -105,7 +109,7 @@ Feature: search products @@ -105,7 +109,7 @@ Feature: search products
105 | owner | name | category | 109 | owner | name | category |
106 | colivre-ent | Noosfero | software-livre | 110 | colivre-ent | Noosfero | software-livre |
107 When I go to the search products page 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 And I press "Search" 113 And I press "Search"
110 Then I should see "Noosfero" within "#search-results" 114 Then I should see "Noosfero" within "#search-results"
111 And I should not see "wikis consultancy" 115 And I should not see "wikis consultancy"
@@ -125,7 +129,7 @@ Feature: search products @@ -125,7 +129,7 @@ Feature: search products
125 | owner | name | category | 129 | owner | name | category |
126 | art-pp | Arte em Madeira | solidaria | 130 | art-pp | Arte em Madeira | solidaria |
127 When I go to the search products page 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 And I press "Search" 133 And I press "Search"
130 Then I should see "Pres. Prudente" within "#facet-menu-f_region" 134 Then I should see "Pres. Prudente" within "#facet-menu-f_region"
131 And I should see ", SP" within "#facet-menu-f_region" 135 And I should see ", SP" within "#facet-menu-f_region"
@@ -145,7 +149,7 @@ Feature: search products @@ -145,7 +149,7 @@ Feature: search products
145 | owner | name | category | 149 | owner | name | category |
146 | art-pp | Arte em Madeira | solidaria | 150 | art-pp | Arte em Madeira | solidaria |
147 When I go to the search products page 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 And I press "Search" 153 And I press "Search"
150 Then I should see "Arte em Madeira" within "#search-results" 154 Then I should see "Arte em Madeira" within "#search-results"
151 155
@@ -157,7 +161,7 @@ Feature: search products @@ -157,7 +161,7 @@ Feature: search products
157 | owner | name | category | 161 | owner | name | category |
158 | colivre-ent | Noosfero Social Network Platform | software-livre | 162 | colivre-ent | Noosfero Social Network Platform | software-livre |
159 When I go to the search products page 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 And I press "Search" 165 And I press "Search"
162 Then I should see "Noosfero Social Network Platform" within "#search-results" 166 Then I should see "Noosfero Social Network Platform" within "#search-results"
163 167
@@ -177,7 +181,7 @@ Feature: search products @@ -177,7 +181,7 @@ Feature: search products
177 | colivre-ent | Noosfero Network | software-livre | 181 | colivre-ent | Noosfero Network | software-livre |
178 | fb | Facebook Network | big-brother | 182 | fb | Facebook Network | big-brother |
179 When I go to the search products page 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 And I press "Search" 185 And I press "Search"
182 And I follow "Software Livre" within "#facets-menu" 186 And I follow "Software Livre" within "#facets-menu"
183 Then I should see "Noosfero Network" within "#search-results" 187 Then I should see "Noosfero Network" within "#search-results"
@@ -206,10 +210,10 @@ Feature: search products @@ -206,10 +210,10 @@ Feature: search products
206 | other | Other open | software-livre | 210 | other | Other open | software-livre |
207 | other | Other closed | big-brother | 211 | other | Other closed | big-brother |
208 When I go to the search products page 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 And I press "Search" 214 And I press "Search"
211 And I follow "Software Livre" within "#facets-menu" 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 And I press "Search" 217 And I press "Search"
214 Then I should see "Other open" within "#search-results" 218 Then I should see "Other open" within "#search-results"
215 And I should not see "Other closed" 219 And I should not see "Other closed"
@@ -217,4 +221,4 @@ Feature: search products @@ -217,4 +221,4 @@ Feature: search products
217 Scenario: don't search when products are disabled in environment 221 Scenario: don't search when products are disabled in environment
218 Given feature "disable_asset_products" is enabled on environment 222 Given feature "disable_asset_products" is enabled on environment
219 When I go to the search products page 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,9 +17,3 @@ Given /^I invite email "(.+)" to be my friend$/ do |email|
17 fill_in('mail_template', :with => 'Follow this link <url>') 17 fill_in('mail_template', :with => 'Follow this link <url>')
18 click_button("Invite my friends!") 18 click_button("Invite my friends!")
19 end 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,6 +422,10 @@ Then /^The page title should contain &quot;(.*)&quot;$/ do |text|
422 end 422 end
423 end 423 end
424 424
  425 +Then /^The page should not contain "(.*)"$/ do |selector|
  426 + page.should have_no_css("#{selector}")
  427 +end
  428 +
425 Given /^the mailbox is empty$/ do 429 Given /^the mailbox is empty$/ do
426 ActionMailer::Base.deliveries = [] 430 ActionMailer::Base.deliveries = []
427 end 431 end
@@ -647,20 +651,26 @@ end @@ -647,20 +651,26 @@ end
647 651
648 When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| 652 When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query|
649 When %{I go to the search #{asset} page} 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 And %{I press "Search"} 655 And %{I press "Search"}
652 end 656 end
653 657
654 Then /^I should see ([^\"]*)'s product image$/ do |product_name| 658 Then /^I should see ([^\"]*)'s product image$/ do |product_name|
655 p = Product.find_by_name product_name 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 end 665 end
659 666
660 Then /^I should not see ([^\"]*)'s product image$/ do |product_name| 667 Then /^I should not see ([^\"]*)'s product image$/ do |product_name|
661 p = Product.find_by_name product_name 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 end 674 end
665 675
666 Then /^I should see ([^\"]*)'s profile image$/ do |name| 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,3 +748,9 @@ Given /^the profile (.*) is configured to (.*) after login$/ do |profile, option
738 profile.redirection_after_login = redirection 748 profile.redirection_after_login = redirection
739 profile.save 749 profile.save
740 end 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