Commit 3f97f285ed690e74dc69cc577c6c9389411c87c3
1 parent
ed69eb7f
Exists in
master
and in
29 other branches
Cucumber features for search
* General, products and enterprise
Showing
6 changed files
with
419 additions
and
16 deletions
Show diff stats
features/search.feature
... | ... | @@ -5,16 +5,17 @@ Feature: search |
5 | 5 | |
6 | 6 | Background: |
7 | 7 | Given the search index is empty |
8 | + And feature "disable_asset_products" is disabled on environment | |
8 | 9 | |
9 | 10 | Scenario: simple search for person |
10 | 11 | Given the following users |
11 | - | login | name | | |
12 | - | joaosilva | Joao Silva | | |
12 | + | login | name | | |
13 | + | joaosilva | Joao Silva | | |
13 | 14 | | josearaujo | Jose Araujo | |
14 | 15 | When I go to the search page |
15 | 16 | And I fill in "query" with "Silva" |
16 | 17 | And I press "Search" |
17 | - Then I should see "Joao Silva" | |
18 | + Then I should see "Joao Silva" within "div.search-results-people" | |
18 | 19 | And I should not see "Jose Araujo" |
19 | 20 | |
20 | 21 | Scenario: simple search for community |
... | ... | @@ -25,7 +26,7 @@ Feature: search |
25 | 26 | And I go to the search page |
26 | 27 | And I fill in "query" with "fancy" |
27 | 28 | And I press "Search" |
28 | - Then I should see "Fancy community" | |
29 | + Then I should see "Fancy community" within "div.search-results-communities" | |
29 | 30 | And I should not see "Boring community" |
30 | 31 | |
31 | 32 | Scenario: simple search for enterprise |
... | ... | @@ -36,7 +37,7 @@ Feature: search |
36 | 37 | And I go to the search page |
37 | 38 | And I fill in "query" with "shoes" |
38 | 39 | And I press "Search" |
39 | - Then I should see "Shoes shop" | |
40 | + Then I should see "Shoes shop" within "div.search-results-enterprises" | |
40 | 41 | And I should not see "Fruits shop" |
41 | 42 | |
42 | 43 | Scenario: simple search for content |
... | ... | @@ -50,28 +51,26 @@ Feature: search |
50 | 51 | When I go to the search page |
51 | 52 | And I fill in "query" with "whales" |
52 | 53 | And I press "Search" |
53 | - Then I should see "whales and dolphins" | |
54 | + Then I should see "whales and dolphins" within "div.search-results-articles" | |
54 | 55 | And I should not see "bees and butterflies" |
55 | 56 | |
56 | - | |
57 | 57 | Scenario: simple search for product |
58 | 58 | Given the following enterprises |
59 | - | identifier | name | | |
59 | + | identifier | name | | |
60 | 60 | | colivre-ent | Colivre | |
61 | 61 | And the following product_categories |
62 | - | name | | |
62 | + | name | | |
63 | 63 | | Development | |
64 | 64 | And the following products |
65 | - | owner | category | name | | |
65 | + | owner | category | name | | |
66 | 66 | | colivre-ent | development | social networks consultancy | |
67 | - | colivre-ent | development | wikis consultancy | | |
67 | + | colivre-ent | development | wikis consultancy | | |
68 | 68 | When I go to the search page |
69 | 69 | And I fill in "query" with "wikis" |
70 | 70 | And I press "Search" |
71 | - Then I should see "wikis consultancy" | |
71 | + Then I should see "wikis consultancy" within "div.search-results-products" | |
72 | 72 | And I should not see "social networks consultancy" |
73 | 73 | |
74 | - | |
75 | 74 | Scenario: simple search for event |
76 | 75 | Given the following communities |
77 | 76 | | identifier | name | |
... | ... | @@ -83,6 +82,25 @@ Feature: search |
83 | 82 | When I go to the search page |
84 | 83 | And I fill in "query" with "birthday" |
85 | 84 | And I press "Search" |
86 | - Then I should see "John Doe's birthday" | |
85 | + Then I should see "John Doe's birthday" within "div.search-results-events" | |
87 | 86 | And I should not see "Group meeting" |
88 | 87 | |
88 | + Scenario: search different types of entities with the same query | |
89 | + Given the following enterprises | |
90 | + | identifier | name | | |
91 | + | colivre | Colivre - Noosfero dev. | | |
92 | + And the following communities | |
93 | + | identifier | name | | |
94 | + | noosfero-users | Noosfero users | | |
95 | + And the following product_categories | |
96 | + | name | | |
97 | + | Development | | |
98 | + And the following products | |
99 | + | owner | name | category | | |
100 | + | colivre | Noosfero platform | Development | | |
101 | + When I go to the search page | |
102 | + And I fill in "query" with "noosfero" | |
103 | + And I press "Search" | |
104 | + Then I should see "Colivre - Noosfero dev." within "div.search-results-enterprises" | |
105 | + And I should see "Noosfero users" within "div.search-results-communities" | |
106 | + And I should see "Noosfero platform" within "div.search-results-products" | ... | ... |
... | ... | @@ -0,0 +1,118 @@ |
1 | +Feature: search enterprises | |
2 | + As a noosfero user | |
3 | + I want to search enterprises | |
4 | + In order to find ones that interest me | |
5 | + | |
6 | + Background: | |
7 | + Given the search index is empty | |
8 | + And the following enterprises | |
9 | + | identifier | name | | |
10 | + | shop1 | Shoes shop | | |
11 | + | shop2 | Fruits shop | | |
12 | + And the following categories as facets | |
13 | + | name | | |
14 | + | Temáticas | | |
15 | + | |
16 | + Scenario: show recent enterprises on index (empty query) | |
17 | + When I go to the search enterprises page | |
18 | + Then I should see "Shoes shop" within "#search-results" | |
19 | + And I should see "Fruits shop" within "#search-results" | |
20 | + | |
21 | + Scenario: simple search for enterprise | |
22 | + When I go to the search enterprises page | |
23 | + And I fill in "query" with "shoes" | |
24 | + And I press "Search" | |
25 | + Then I should see "Shoes shop" | |
26 | + And I should not see "Fruits shop" | |
27 | + | |
28 | + Scenario: see default facets when searching | |
29 | + When I go to the search enterprises page | |
30 | + And I fill in "query" with "shoes" | |
31 | + And I press "Search" | |
32 | + Then I should see "City" within "#facets-menu" | |
33 | + | |
34 | + Scenario: see category facets when searching | |
35 | + When I go to the search enterprises page | |
36 | + And I fill in "query" with "shoes" | |
37 | + And I press "Search" | |
38 | + Then I should see "Temáticas" within "#facets-menu" | |
39 | + | |
40 | + Scenario: see region on facets and results | |
41 | + Given the following cities | |
42 | + | name | state | | |
43 | + | Pres. Prudente | SP | | |
44 | + And the following enterprises | |
45 | + | identifier | name | city | | |
46 | + | art-pp | Artesanato PP | Pres. Prudente | | |
47 | + When I go to the search enterprises page | |
48 | + And I fill in "query" with "Artesanato" | |
49 | + And I press "Search" | |
50 | + Then I should see "Pres. Prudente" within "#facet-menu-f_region" | |
51 | + And I should see ", SP" within "#facet-menu-f_region" | |
52 | + And I should see "Pres. Prudente, SP" within "#search-results" | |
53 | + | |
54 | + Scenario: find enterprise by region | |
55 | + Given the following cities | |
56 | + | name | state | | |
57 | + | Pres. Prudente | SP | | |
58 | + And the following enterprises | |
59 | + | identifier | name | city | | |
60 | + | art-pp | Artesanato PP | Pres. Prudente | | |
61 | + When I go to the search enterprises page | |
62 | + And I fill in "query" with "Prudente" | |
63 | + And I press "Search" | |
64 | + Then I should see "Artesanato PP" within "#search-results" | |
65 | + | |
66 | + Scenario: find enterprise by category | |
67 | + Given the following categories | |
68 | + | name | | |
69 | + | Software Livre | | |
70 | + And the following enterprises | |
71 | + | identifier | name | category | | |
72 | + | noosfero | Noosfero | software-livre | | |
73 | + When I go to the search enterprises page | |
74 | + And I fill in "query" with "software" | |
75 | + And I press "Search" | |
76 | + Then I should see "Noosfero" within "#search-results" | |
77 | + | |
78 | + Scenario: find enterprises without exact query | |
79 | + Given the following enterprises | |
80 | + | identifier | name | | |
81 | + | noosfero | Noosfero Developers Association | | |
82 | + When I go to the search enterprises page | |
83 | + And I fill in "query" with "Noosfero Association" | |
84 | + And I press "Search" | |
85 | + Then I should see "Noosfero Developers Association" within "#search-results" | |
86 | + | |
87 | + Scenario: filter enterprises by facet | |
88 | + Given the following category | |
89 | + | name | parent | | |
90 | + | Software Livre | tematicas | | |
91 | + And the following enterprises | |
92 | + | identifier | name | category | | |
93 | + | noosfero | Noosfero Developers | software-livre | | |
94 | + | facebook | Facebook Developers | | | |
95 | + When I go to the search enterprises page | |
96 | + And I fill in "query" with "Developers" | |
97 | + And I press "Search" | |
98 | + And I follow "Software Livre" within "#facets-menu" | |
99 | + Then I should see "Noosfero Developers" within "#search-results" | |
100 | + And I should not see "Facebook Developers" | |
101 | + | |
102 | + Scenario: remember facet filter when searching new query | |
103 | + Given the following category | |
104 | + | name | parent | | |
105 | + | Software Livre | tematicas | | |
106 | + And the following enterprises | |
107 | + | identifier | name | category | | |
108 | + | noosfero | Noosfero Developers | software-livre | | |
109 | + | rails-dev | Rails Developers | | | |
110 | + | rails-usr | Rails Users | software-livre | | |
111 | + When I go to the search enterprises page | |
112 | + And I fill in "query" with "Developers" | |
113 | + And I press "Search" | |
114 | + And I follow "Software Livre" within "#facets-menu" | |
115 | + And I fill in "query" with "Rails" | |
116 | + And I press "Search" | |
117 | + Then I should see "Rails Users" within "#search-results" | |
118 | + And I should not see "Rails Developers" | ... | ... |
... | ... | @@ -0,0 +1,210 @@ |
1 | +Feature: search products | |
2 | + As a noosfero user | |
3 | + I want to search products | |
4 | + In order to find ones that interest me | |
5 | + | |
6 | + Background: | |
7 | + Given the search index is empty | |
8 | + And feature "disable_asset_products" is disabled on environment | |
9 | + And the following enterprises | |
10 | + | identifier | name | | |
11 | + | colivre-ent | Colivre | | |
12 | + And the following product_categories | |
13 | + | name | | |
14 | + | Development | | |
15 | + And the following products | |
16 | + | owner | category | name | price | | |
17 | + | colivre-ent | development | social networks consultancy | 1.00 | | |
18 | + | colivre-ent | development | wikis consultancy | 2.00 | | |
19 | + | |
20 | + Scenario: show recent products on index (empty query) | |
21 | + When I go to the search products page | |
22 | + Then I should see "wikis consultancy" within "#search-results" | |
23 | + And I should see "social networks consultancy" within "#search-results" | |
24 | + | |
25 | + Scenario: simple search for product | |
26 | + When I go to the search products page | |
27 | + And I fill in "query" with "wikis" | |
28 | + And I press "Search" | |
29 | + Then I should see "wikis consultancy" within "#search-results" | |
30 | + And I should not see "social networks consultancy" | |
31 | + | |
32 | + Scenario: see default facets when searching | |
33 | + When I go to the search products page | |
34 | + And I fill in "query" with "wikis" | |
35 | + And I press "Search" | |
36 | + Then I should see "Related products" within "#facets-menu" | |
37 | + Then I should see "City" within "#facets-menu" | |
38 | + Then I should see "Qualifiers" within "#facets-menu" | |
39 | + | |
40 | + Scenario: show percentage (100%) of solidary economy inputs in results | |
41 | + Given the following inputs | |
42 | + | product | category | solidary | | |
43 | + | wikis consultancy | development | true | | |
44 | + When I go to the search products page | |
45 | + And I fill in "query" with "wikis" | |
46 | + And I press "Search" | |
47 | + Then I should see "100%" within "div.search-product-ecosol-percentage-icon-100" | |
48 | + | |
49 | + Scenario: show percentage (50%) of solidary economy inputs in results | |
50 | + Given the following inputs | |
51 | + | product | category | solidary | | |
52 | + | wikis consultancy | development | true | | |
53 | + | wikis consultancy | development | false | | |
54 | + When I go to the search products page | |
55 | + And I fill in "query" with "wikis" | |
56 | + And I press "Search" | |
57 | + Then I should see "50%" within "div.search-product-ecosol-percentage-icon-50" | |
58 | + | |
59 | + Scenario: show percentage (75%) of solidary economy inputs in results | |
60 | + Given the following inputs | |
61 | + | product | category | solidary | | |
62 | + | wikis consultancy | development | true | | |
63 | + | wikis consultancy | development | true | | |
64 | + | wikis consultancy | development | true | | |
65 | + | wikis consultancy | development | false | | |
66 | + When I go to the search products page | |
67 | + And I fill in "query" with "wikis" | |
68 | + And I press "Search" | |
69 | + Then I should see "75%" within "div.search-product-ecosol-percentage-icon-75" | |
70 | + | |
71 | + Scenario: show percentage (25%) of solidary economy inputs in results | |
72 | + Given the following inputs | |
73 | + | product | category | solidary | | |
74 | + | wikis consultancy | development | true | | |
75 | + | wikis consultancy | development | false | | |
76 | + | wikis consultancy | development | false | | |
77 | + | wikis consultancy | development | false | | |
78 | + When I go to the search products page | |
79 | + And I fill in "query" with "wikis" | |
80 | + And I press "Search" | |
81 | + Then I should see "25%" within "div.search-product-ecosol-percentage-icon-25" | |
82 | + | |
83 | + Scenario: display "zoom in" button on images on results | |
84 | + Given the following products | |
85 | + | owner | category | name | price | img | | |
86 | + | colivre-ent | development | noosfero | 12.34 | noosfero-network | | |
87 | + When I go to the search products page | |
88 | + And I fill in "query" with "noosfero" | |
89 | + And I press "Search" | |
90 | + Then I should not see "No image" | |
91 | + And I should see "Zoom in" within "a.zoomify-image" | |
92 | + | |
93 | + Scenario: search products by category | |
94 | + Given the following product_category | |
95 | + | name | | |
96 | + | Software Livre | | |
97 | + And the following product | |
98 | + | owner | name | category | | |
99 | + | colivre-ent | Noosfero | software-livre | | |
100 | + When I go to the search products page | |
101 | + And I fill in "query" with "software livre" | |
102 | + And I press "Search" | |
103 | + Then I should see "Noosfero" within "#search-results" | |
104 | + And I should not see "wikis consultancy" | |
105 | + And I should not see "social networks consultancy" | |
106 | + | |
107 | + Scenario: see region on facets and results | |
108 | + Given the following cities | |
109 | + | name | state | | |
110 | + | Pres. Prudente | SP | | |
111 | + And the following enterprise | |
112 | + | identifier | name | city | | |
113 | + | art-pp | Artesanato PP | Pres. Prudente | | |
114 | + And the following product_category | |
115 | + | name | | |
116 | + | Solidária | | |
117 | + And the following product | |
118 | + | owner | name | category | | |
119 | + | art-pp | Arte em Madeira | solidaria | | |
120 | + When I go to the search products page | |
121 | + And I fill in "query" with "Madeira" | |
122 | + And I press "Search" | |
123 | + Then I should see "Pres. Prudente" within "#facet-menu-f_region" | |
124 | + And I should see ", SP" within "#facet-menu-f_region" | |
125 | + And I should see "Pres. Prudente, SP" within "#search-results" | |
126 | + | |
127 | + Scenario: find product by region | |
128 | + Given the following cities | |
129 | + | name | state | | |
130 | + | Pres. Prudente | SP | | |
131 | + And the following enterprise | |
132 | + | identifier | name | city | | |
133 | + | art-pp | Artesanato PP | Pres. Prudente | | |
134 | + And the following product_category | |
135 | + | name | | |
136 | + | Solidária | | |
137 | + And the following product | |
138 | + | owner | name | category | | |
139 | + | art-pp | Arte em Madeira | solidaria | | |
140 | + When I go to the search products page | |
141 | + And I fill in "query" with "Prudente" | |
142 | + And I press "Search" | |
143 | + Then I should see "Arte em Madeira" within "#search-results" | |
144 | + | |
145 | + Scenario: find products without exact query | |
146 | + Given the following enterprise | |
147 | + | identifier | name | | |
148 | + | colivre | Colivre | | |
149 | + And the following product_category | |
150 | + | name | | |
151 | + | Software Livre | | |
152 | + And the following products | |
153 | + | owner | name | category | | |
154 | + | colivre | Noosfero Social Network Platform | software-livre | | |
155 | + When I go to the search products page | |
156 | + And I fill in "query" with "Noosfero Network" | |
157 | + And I press "Search" | |
158 | + Then I should see "Noosfero Social Network Platform" within "#search-results" | |
159 | + | |
160 | + Scenario: filter products by facet | |
161 | + Given the following enterprises | |
162 | + | identifier | name | | |
163 | + | colivre | Colivre | | |
164 | + | fb | FB inc. | | |
165 | + And the following categories as facets | |
166 | + | name | | |
167 | + | Temáticas | | |
168 | + And the following product_categories | |
169 | + | name | parent | | |
170 | + | Software Livre | tematicas | | |
171 | + | Big Brother | tematicas | | |
172 | + And the following products | |
173 | + | owner | name | category | | |
174 | + | colivre | Noosfero Network | software-livre | | |
175 | + | fb | Facebook Network | big-brother | | |
176 | + When I go to the search products page | |
177 | + And I fill in "query" with "Network" | |
178 | + And I press "Search" | |
179 | + And I follow "Software Livre" within "#facets-menu" | |
180 | + Then I should see "Noosfero Network" within "#search-results" | |
181 | + And I should not see "Facebook Network" | |
182 | + | |
183 | + Scenario: remember facet filter when searching new query | |
184 | + Given the following enterprises | |
185 | + | identifier | name | | |
186 | + | colivre | Colivre | | |
187 | + | fb | FB inc. | | |
188 | + | other | Other | | |
189 | + And the following categories as facets | |
190 | + | name | | |
191 | + | Temáticas | | |
192 | + And the following product_categories | |
193 | + | name | parent | | |
194 | + | Software Livre | tematicas | | |
195 | + | Big Brother | tematicas | | |
196 | + | Other | tematicas | | |
197 | + And the following products | |
198 | + | owner | name | category | | |
199 | + | colivre | Noosfero Network | software-livre | | |
200 | + | fb | Facebook Network | big-brother | | |
201 | + | other | Other open | software-livre | | |
202 | + | other | Other closed | big-brother | | |
203 | + When I go to the search products page | |
204 | + And I fill in "query" with "Network" | |
205 | + And I press "Search" | |
206 | + And I follow "Software Livre" within "#facets-menu" | |
207 | + And I fill in "query" with "Other" | |
208 | + And I press "Search" | |
209 | + Then I should see "Other open" within "#search-results" | |
210 | + And I should not see "Other closed" | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -7,7 +7,13 @@ Given /^the following users?$/ do |table| |
7 | 7 | table.hashes.each do |item| |
8 | 8 | person_data = item.dup |
9 | 9 | person_data.delete("login") |
10 | - User.create!(:login => item[:login], :password => '123456', :password_confirmation => '123456', :email => item[:login] + "@example.com", :person_data => person_data).activate | |
10 | + category = Category.find_by_slug person_data.delete("category") | |
11 | + user = User.create!(:login => item[:login], :password => '123456', :password_confirmation => '123456', :email => item[:login] + "@example.com", :person_data => person_data) | |
12 | + user.activate | |
13 | + p = user.person | |
14 | + p.categories << category if category | |
15 | + p.save! | |
16 | + user.save! | |
11 | 17 | end |
12 | 18 | end |
13 | 19 | |
... | ... | @@ -25,6 +31,8 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | |
25 | 31 | table.hashes.each do |row| |
26 | 32 | owner = row.delete("owner") |
27 | 33 | domain = row.delete("domain") |
34 | + city = row.delete("city") | |
35 | + category = row.delete("category") | |
28 | 36 | organization = klass.create!(row) |
29 | 37 | if owner |
30 | 38 | organization.add_admin(Profile[owner]) |
... | ... | @@ -33,6 +41,15 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | |
33 | 41 | d = Domain.new :name => domain, :owner => organization |
34 | 42 | d.save(false) |
35 | 43 | end |
44 | + if city | |
45 | + c = City.find_by_name city | |
46 | + organization.region = c | |
47 | + end | |
48 | + if category && !category.blank? | |
49 | + cat = Category.find_by_slug category | |
50 | + organization.categories << cat | |
51 | + end | |
52 | + organization.save! | |
36 | 53 | end |
37 | 54 | end |
38 | 55 | |
... | ... | @@ -95,6 +112,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries)$/ do |con |
95 | 112 | owner = Profile[owner_identifier] |
96 | 113 | home = item.delete("homepage") |
97 | 114 | language = item.delete("lang") |
115 | + category = item.delete("category") | |
98 | 116 | translation_of_id = nil |
99 | 117 | if item["translation_of"] |
100 | 118 | if item["translation_of"] != "nil" |
... | ... | @@ -111,6 +129,12 @@ Given /^the following (articles|events|blogs|folders|forums|galleries)$/ do |con |
111 | 129 | if parent |
112 | 130 | result.parent = Article.find_by_name(parent) |
113 | 131 | end |
132 | + if category | |
133 | + cat = Category.find_by_slug category | |
134 | + if cat | |
135 | + result.add_category(cat) | |
136 | + end | |
137 | + end | |
114 | 138 | result.save! |
115 | 139 | if home == 'true' |
116 | 140 | owner.home_page = result |
... | ... | @@ -182,7 +206,9 @@ Given /^the following inputs?$/ do |table| |
182 | 206 | product = Product.find_by_name(data.delete("product")) |
183 | 207 | category = Category.find_by_slug(data.delete("category").to_slug) |
184 | 208 | unit = Unit.find_by_singular(data.delete("unit")) |
185 | - input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit)) | |
209 | + solidary = data.delete("solidary") | |
210 | + input = Input.create!(data.merge(:product => product, :product_category => category, :unit => unit, | |
211 | + :is_from_solidarity_economy => solidary)) | |
186 | 212 | input.update_attributes!(:position => data['position']) |
187 | 213 | end |
188 | 214 | end |
... | ... | @@ -570,3 +596,31 @@ end |
570 | 596 | Given /^the search index is empty$/ do |
571 | 597 | ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) |
572 | 598 | end |
599 | + | |
600 | +# This could be merged with "the following categories" | |
601 | +Given /^the following categories as facets$/ do |table| | |
602 | + ids = [] | |
603 | + table.hashes.each do |item| | |
604 | + cat = Category.find_by_name(item[:name]) | |
605 | + if cat.nil? | |
606 | + cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name]) | |
607 | + end | |
608 | + ids << cat.id | |
609 | + end | |
610 | + env = Environment.default | |
611 | + env.top_level_category_as_facet_ids = ids | |
612 | + env.save! | |
613 | +end | |
614 | + | |
615 | +Given /^the following cities$/ do |table| | |
616 | + table.hashes.each do |item| | |
617 | + state = State.find_by_acronym item[:state] | |
618 | + if !state | |
619 | + state = State.create!(:name => item[:state], :acronym => item[:state], :environment_id => Environment.default.id) | |
620 | + end | |
621 | + city = City.create!(:name => item[:name], :environment_id => Environment.default.id) | |
622 | + city.parent = state | |
623 | + city.save! | |
624 | + end | |
625 | +end | |
626 | + | ... | ... |
features/support/paths.rb
96.8 KB