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 27 Then I should not see "Beans"
28 28 And I should not see "Potatoes"
29 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 84  
85 85 Scenario: simple search for uploaded file
86 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 96 Scenario: show event search results without end date
97 97 Given the following communities
... ... @@ -127,7 +127,6 @@ Feature: search contents
127 127 | joaosilva | Games Forum |
128 128 And the following articles
129 129 | owner | name | parent |
130   - | joaosilva | The Old Republic | Games Forum |
131 130 | joaosilva | Mass Effect 3 | Games Forum |
132 131 | joaosilva | The Witcher 2 | Games Forum |
133 132 | joaosilva | Syndicate | Games Forum |
... ... @@ -138,7 +137,6 @@ Feature: search contents
138 137 And I should see "Syndicate"
139 138 And I should see "The Witcher 2"
140 139 And I should see "Mass Effect 3"
141   - And I should not see "The Old Republic"
142 140 And I should not see "Diablo 3"
143 141 When I follow "The Witcher 2"
144 142 Then I should be on article "The Witcher 2"
... ... @@ -148,12 +146,12 @@ Feature: search contents
148 146 | owner | name |
149 147 | joaosilva | Folder for Uploaded Files |
150 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 152 Then I should see "Folder for Uploaded Files" within ".search-uploaded-file-parent"
155 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 156 Scenario: link to author on search results
159 157 When I go to the search articles page
... ... @@ -207,17 +205,15 @@ Feature: search contents
207 205 Scenario: link to categories on search results
208 206 Given the following category
209 207 | name |
210   - | Soviet ice hockey players |
  208 + | Soviet |
211 209 And the following articles
212 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 212 When I go to the search articles page
215 213 And I fill in "query" with "hockey"
216 214 And I press "Search"
217 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 218 Scenario: show empty categories on search results
223 219 When I go to the search articles page
... ... @@ -236,7 +232,7 @@ Feature: search contents
236 232 | sglaspell | Susan Glaspell |
237 233 And the article "whales and dolphins" is updated by "Susan Glaspell"
238 234 When I search contents for "whales"
239   - Then show me the page
  235 + # Then show me the page
240 236 Then I should see "by Susan Glaspell at" within ".search-article-author-changes"
241 237  
242 238 Scenario: search articles by category
... ...
features/search_enterprises.feature
... ... @@ -38,18 +38,21 @@ Feature: search enterprises
38 38 When I follow "Shoes shop"
39 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 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 45 When I search enterprises for "shoes"
49 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 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 57 Scenario: see default facets when searching
55 58 When I go to the search enterprises page
... ... @@ -68,7 +71,7 @@ Feature: search enterprises
68 71 | name | state |
69 72 | Pres. Prudente | SP |
70 73 And the following enterprises
71   - | identifier | name | city |
  74 + | identifier | name | region |
72 75 | art-pp | Artesanato PP | Pres. Prudente |
73 76 When I go to the search enterprises page
74 77 And I fill in "query" with "Artesanato"
... ... @@ -83,7 +86,7 @@ Feature: search enterprises
83 86 | name | state |
84 87 | Pres. Prudente | SP |
85 88 And the following enterprises
86   - | identifier | name | city |
  89 + | identifier | name | region |
87 90 | art-pp | Artesanato PP | Pres. Prudente |
88 91 When I go to the search enterprises page
89 92 And I fill in "query" with "Prudente"
... ...
features/search_products.feature
... ... @@ -116,7 +116,7 @@ Feature: search products
116 116 | name | state |
117 117 | Pres. Prudente | SP |
118 118 And the following enterprise
119   - | identifier | name | city |
  119 + | identifier | name | region |
120 120 | art-pp | Artesanato PP | Pres. Prudente |
121 121 And the following product_category
122 122 | name |
... ... @@ -136,7 +136,7 @@ Feature: search products
136 136 | name | state |
137 137 | Pres. Prudente | SP |
138 138 And the following enterprise
139   - | identifier | name | city |
  139 + | identifier | name | region |
140 140 | art-pp | Artesanato PP | Pres. Prudente |
141 141 And the following product_category
142 142 | name |
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -33,6 +33,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
33 33 domain = row.delete("domain")
34 34 category = row.delete("category")
35 35 img_name = row.delete("img")
  36 + city = row.delete("region")
36 37 organization = klass.create!(row)
37 38 if owner
38 39 organization.add_admin(Profile[owner])
... ... @@ -41,7 +42,6 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do |
41 42 d = Domain.new :name => domain, :owner => organization
42 43 d.save(false)
43 44 end
44   - city = row.delete("city")
45 45 if city
46 46 c = City.find_by_name city
47 47 organization.region = c
... ... @@ -134,10 +134,10 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f
134 134 :language => language,
135 135 :translation_of_id => translation_of_id)
136 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 138 end
139 139 result = klass.new(item)
140   - if parent
  140 + if !parent.blank?
141 141 result.parent = Article.find_by_name(parent)
142 142 end
143 143 if category
... ...
features/support/paths.rb
... ... @@ -17,6 +17,9 @@ module NavigationHelpers
17 17 when /article "([^"]+)"\s*$/
18 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 23 when /edit "(.+)" by (.+)/
21 24 article_id = Person[$2].articles.find_by_slug($1.to_slug).id
22 25 "/myprofile/#{$2}/cms/edit/#{article_id}"
... ...