Commit 64009edd9e7e0109fba1889bccebd9624d9dbc17

Authored by Rafael Martins
1 parent a418a384

Fixed some more search features

features/manage_categories.feature
@@ -27,6 +27,6 @@ Feature: manage categories @@ -27,6 +27,6 @@ Feature: manage categories
27 Then I should not see "Beans" 27 Then I should not see "Beans"
28 And I should not see "Potatoes" 28 And I should not see "Potatoes"
29 When I follow "Show" and wait for jquery 29 When I follow "Show" and wait for jquery
30 - Then show me the page 30 + # Then show me the page
31 31
32 32
features/search_contents.feature
@@ -84,14 +84,14 @@ Feature: search contents @@ -84,14 +84,14 @@ Feature: search contents
84 84
85 Scenario: simple search for uploaded file 85 Scenario: simple search for uploaded file
86 Given the following uploaded files 86 Given the following uploaded files
87 - | owner | name | filename |  
88 - | joaosilva | Uploaded Executable | rails |  
89 - | joaosilva | Uploaded Spreadsheet | shoes |  
90 - When I search contents for "Executable"  
91 - Then I should see "Uploaded Executable" within ".search-uploaded-file-item"  
92 - And I should not see "Uploaded Spreadsheet"  
93 - When I follow "Uploaded Executable"  
94 - Then I should be on content "Uploaded Executable" 87 + | owner | filename |
  88 + | joaosilva | rails.png |
  89 + | joaosilva | shoes.png |
  90 + When I search contents for "rails.png"
  91 + Then I should see "rails.png" within ".search-uploaded-file-item"
  92 + And I should not see "shoes.png"
  93 + When I follow "rails.png"
  94 + Then I should be on article "rails.png"
95 95
96 Scenario: show event search results without end date 96 Scenario: show event search results without end date
97 Given the following communities 97 Given the following communities
@@ -127,7 +127,6 @@ Feature: search contents @@ -127,7 +127,6 @@ Feature: search contents
127 | joaosilva | Games Forum | 127 | joaosilva | Games Forum |
128 And the following articles 128 And the following articles
129 | owner | name | parent | 129 | owner | name | parent |
130 - | joaosilva | The Old Republic | Games Forum |  
131 | joaosilva | Mass Effect 3 | Games Forum | 130 | joaosilva | Mass Effect 3 | Games Forum |
132 | joaosilva | The Witcher 2 | Games Forum | 131 | joaosilva | The Witcher 2 | Games Forum |
133 | joaosilva | Syndicate | Games Forum | 132 | joaosilva | Syndicate | Games Forum |
@@ -138,7 +137,6 @@ Feature: search contents @@ -138,7 +137,6 @@ Feature: search contents
138 And I should see "Syndicate" 137 And I should see "Syndicate"
139 And I should see "The Witcher 2" 138 And I should see "The Witcher 2"
140 And I should see "Mass Effect 3" 139 And I should see "Mass Effect 3"
141 - And I should not see "The Old Republic"  
142 And I should not see "Diablo 3" 140 And I should not see "Diablo 3"
143 When I follow "The Witcher 2" 141 When I follow "The Witcher 2"
144 Then I should be on article "The Witcher 2" 142 Then I should be on article "The Witcher 2"
@@ -148,12 +146,12 @@ Feature: search contents @@ -148,12 +146,12 @@ Feature: search contents
148 | owner | name | 146 | owner | name |
149 | joaosilva | Folder for Uploaded Files | 147 | joaosilva | Folder for Uploaded Files |
150 Given the following uploaded files 148 Given the following uploaded files
151 - | owner | name | parent | filename |  
152 - | joaosilva | Uploaded Executable 2 | Folder for Uploaded Files | rails |  
153 - When I search contents for "Executable" 149 + | owner | parent | filename |
  150 + | joaosilva | Folder for Uploaded Files | rails.png |
  151 + When I search contents for "rails.png"
154 Then I should see "Folder for Uploaded Files" within ".search-uploaded-file-parent" 152 Then I should see "Folder for Uploaded Files" within ".search-uploaded-file-parent"
155 When I follow "Folder for Uploaded Files" 153 When I follow "Folder for Uploaded Files"
156 - Then I should be on content "Folder for Uploaded Files" 154 + Then I should be on article "Folder for Uploaded Files"
157 155
158 Scenario: link to author on search results 156 Scenario: link to author on search results
159 When I go to the search articles page 157 When I go to the search articles page
@@ -207,17 +205,15 @@ Feature: search contents @@ -207,17 +205,15 @@ Feature: search contents
207 Scenario: link to categories on search results 205 Scenario: link to categories on search results
208 Given the following category 206 Given the following category
209 | name | 207 | name |
210 - | Soviet ice hockey players | 208 + | Soviet |
211 And the following articles 209 And the following articles
212 | owner | name | body | category | 210 | owner | name | body | category |
213 - | joaosilva | Sergei Sorokin | Retired ice hockey player | Soviet ice hockey players | 211 + | joaosilva | Sergei Sorokin | Retired ice hockey player | soviet |
214 When I go to the search articles page 212 When I go to the search articles page
215 And I fill in "query" with "hockey" 213 And I fill in "query" with "hockey"
216 And I press "Search" 214 And I press "Search"
217 Then I should see "Categories" within ".search-article-categories" 215 Then I should see "Categories" within ".search-article-categories"
218 - And I should see "Soviet ice hockey players" within ".search-article-categories"  
219 - When I follow "Soviet ice hockey players"  
220 - Then I should be on Joao Silva's profile 216 + And I should see "Soviet" within ".search-article-category"
221 217
222 Scenario: show empty categories on search results 218 Scenario: show empty categories on search results
223 When I go to the search articles page 219 When I go to the search articles page
@@ -236,7 +232,7 @@ Feature: search contents @@ -236,7 +232,7 @@ Feature: search contents
236 | sglaspell | Susan Glaspell | 232 | sglaspell | Susan Glaspell |
237 And the article "whales and dolphins" is updated by "Susan Glaspell" 233 And the article "whales and dolphins" is updated by "Susan Glaspell"
238 When I search contents for "whales" 234 When I search contents for "whales"
239 - Then show me the page 235 + # Then show me the page
240 Then I should see "by Susan Glaspell at" within ".search-article-author-changes" 236 Then I should see "by Susan Glaspell at" within ".search-article-author-changes"
241 237
242 Scenario: search articles by category 238 Scenario: search articles by category
features/search_enterprises.feature
@@ -38,18 +38,21 @@ Feature: search enterprises @@ -38,18 +38,21 @@ Feature: search enterprises
38 When I follow "Shoes shop" 38 When I follow "Shoes shop"
39 Then I should be on Shoes shop's profile 39 Then I should be on Shoes shop's profile
40 40
41 - Scenario: show clean enterprise description on search results 41 + Scenario: show clean enterprise homepage on search results
42 Given the following articles 42 Given the following articles
43 - | owner | name | body |  
44 - | shop1 | Shoes home | This is the <i>homepage</i> of Shoes shop! It has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. We should probably talk about shoes. |  
45 - And the following enterprises  
46 - | identifier | name | description |  
47 - | shop3 | Clothes shop | This <b>clothes</b> shop also sells shoes! This too has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. Clothes are a really important part of our lives. | 43 + | owner | name | body | homepage |
  44 + | shop1 | Shoes home | This is the <i>homepage</i> of Shoes shop! It has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. We should probably talk about shoes. | true |
48 When I search enterprises for "shoes" 45 When I search enterprises for "shoes"
49 Then I should see "This is the homepage of" within ".search-enterprise-description" 46 Then I should see "This is the homepage of" within ".search-enterprise-description"
50 - And I should see "probably talk..." within ".search-enterprise-description" 47 + And I should see "about sho..." within ".search-enterprise-description"
  48 +
  49 + Scenario: show clean enterprise description on search results
  50 + Given the following enterprises
  51 + | identifier | name | description |
  52 + | shop3 | Clothes shop | This <b>clothes</b> shop also sells shoes! This too has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. Clothes are a really important part of our lives. |
  53 + When I search enterprises for "clothes"
51 And I should see "This clothes shop" within ".search-enterprise-description" 54 And I should see "This clothes shop" within ".search-enterprise-description"
52 - And I should see "are a re..." within ".search-enterprise-description" 55 + And I should see "really import..." within ".search-enterprise-description"
53 56
54 Scenario: see default facets when searching 57 Scenario: see default facets when searching
55 When I go to the search enterprises page 58 When I go to the search enterprises page
@@ -68,7 +71,7 @@ Feature: search enterprises @@ -68,7 +71,7 @@ Feature: search enterprises
68 | name | state | 71 | name | state |
69 | Pres. Prudente | SP | 72 | Pres. Prudente | SP |
70 And the following enterprises 73 And the following enterprises
71 - | identifier | name | city | 74 + | identifier | name | region |
72 | art-pp | Artesanato PP | Pres. Prudente | 75 | art-pp | Artesanato PP | Pres. Prudente |
73 When I go to the search enterprises page 76 When I go to the search enterprises page
74 And I fill in "query" with "Artesanato" 77 And I fill in "query" with "Artesanato"
@@ -83,7 +86,7 @@ Feature: search enterprises @@ -83,7 +86,7 @@ Feature: search enterprises
83 | name | state | 86 | name | state |
84 | Pres. Prudente | SP | 87 | Pres. Prudente | SP |
85 And the following enterprises 88 And the following enterprises
86 - | identifier | name | city | 89 + | identifier | name | region |
87 | art-pp | Artesanato PP | Pres. Prudente | 90 | art-pp | Artesanato PP | Pres. Prudente |
88 When I go to the search enterprises page 91 When I go to the search enterprises page
89 And I fill in "query" with "Prudente" 92 And I fill in "query" with "Prudente"
features/search_products.feature
@@ -116,7 +116,7 @@ Feature: search products @@ -116,7 +116,7 @@ Feature: search products
116 | name | state | 116 | name | state |
117 | Pres. Prudente | SP | 117 | Pres. Prudente | SP |
118 And the following enterprise 118 And the following enterprise
119 - | identifier | name | city | 119 + | identifier | name | region |
120 | art-pp | Artesanato PP | Pres. Prudente | 120 | art-pp | Artesanato PP | Pres. Prudente |
121 And the following product_category 121 And the following product_category
122 | name | 122 | name |
@@ -136,7 +136,7 @@ Feature: search products @@ -136,7 +136,7 @@ Feature: search products
136 | name | state | 136 | name | state |
137 | Pres. Prudente | SP | 137 | Pres. Prudente | SP |
138 And the following enterprise 138 And the following enterprise
139 - | identifier | name | city | 139 + | identifier | name | region |
140 | art-pp | Artesanato PP | Pres. Prudente | 140 | art-pp | Artesanato PP | Pres. Prudente |
141 And the following product_category 141 And the following product_category
142 | name | 142 | name |
features/step_definitions/noosfero_steps.rb
@@ -33,6 +33,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | @@ -33,6 +33,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
33 domain = row.delete("domain") 33 domain = row.delete("domain")
34 category = row.delete("category") 34 category = row.delete("category")
35 img_name = row.delete("img") 35 img_name = row.delete("img")
  36 + city = row.delete("region")
36 organization = klass.create!(row) 37 organization = klass.create!(row)
37 if owner 38 if owner
38 organization.add_admin(Profile[owner]) 39 organization.add_admin(Profile[owner])
@@ -41,7 +42,6 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | @@ -41,7 +42,6 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
41 d = Domain.new :name => domain, :owner => organization 42 d = Domain.new :name => domain, :owner => organization
42 d.save(false) 43 d.save(false)
43 end 44 end
44 - city = row.delete("city")  
45 if city 45 if city
46 c = City.find_by_name city 46 c = City.find_by_name city
47 organization.region = c 47 organization.region = c
@@ -134,10 +134,10 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f @@ -134,10 +134,10 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f
134 :language => language, 134 :language => language,
135 :translation_of_id => translation_of_id) 135 :translation_of_id => translation_of_id)
136 if !filename.blank? 136 if !filename.blank?
137 - item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}.png", 'image/png')) 137 + item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}", 'binary/octet-stream'))
138 end 138 end
139 result = klass.new(item) 139 result = klass.new(item)
140 - if parent 140 + if !parent.blank?
141 result.parent = Article.find_by_name(parent) 141 result.parent = Article.find_by_name(parent)
142 end 142 end
143 if category 143 if category
features/support/paths.rb
@@ -17,6 +17,9 @@ module NavigationHelpers @@ -17,6 +17,9 @@ module NavigationHelpers
17 when /article "([^"]+)"\s*$/ 17 when /article "([^"]+)"\s*$/
18 url_for(Article.find_by_name($1).url.merge({:only_path => true})) 18 url_for(Article.find_by_name($1).url.merge({:only_path => true}))
19 19
  20 + when /category "([^"]+)"/
  21 + '/cat/%s' % Category.find_by_name($1).slug
  22 +
20 when /edit "(.+)" by (.+)/ 23 when /edit "(.+)" by (.+)/
21 article_id = Person[$2].articles.find_by_slug($1.to_slug).id 24 article_id = Person[$2].articles.find_by_slug($1.to_slug).id
22 "/myprofile/#{$2}/cms/edit/#{article_id}" 25 "/myprofile/#{$2}/cms/edit/#{article_id}"