diff --git a/features/search_products.feature b/features/search_products.feature index e66a40e..8de2bfe 100644 --- a/features/search_products.feature +++ b/features/search_products.feature @@ -21,14 +21,18 @@ Feature: search products When I go to the search products page Then I should see "wikis consultancy" within "#search-results" And I should see "social networks consultancy" within "#search-results" - And I should not see content inside "div.pagination" - And I should not see content inside "#facets-menu" + + Scenario: not show pagination and facets on recent products + When I go to the search products page + Then The page should not contain "div.pagination" + And The page should not contain "#facets-menu" Scenario: show empty search results When I search products for "something unrelated" Then I should see "None" within ".search-results-type-empty" Scenario: simple search for product + Given there are no pending jobs When I search products for "wikis" Then I should see "wikis consultancy" within "#search-results" And I should see "wikis consultancy" within ".only-one-result-box" @@ -38,7 +42,7 @@ Feature: search products Scenario: see default facets when searching When I go to the search products page - And I fill in "query" with "wikis" + And I fill in "search-input" with "wikis" And I press "Search" Then I should see "Related products" within "#facets-menu" Then I should see "City" within "#facets-menu" @@ -49,7 +53,7 @@ Feature: search products | product | category | solidary | | wikis consultancy | development | true | When I go to the search products page - And I fill in "query" with "wikis" + And I fill in "search-input" with "wikis" And I press "Search" Then I should see "100%" within "div.search-product-ecosol-percentage-icon-100" @@ -59,7 +63,7 @@ Feature: search products | wikis consultancy | development | true | | wikis consultancy | development | false | When I go to the search products page - And I fill in "query" with "wikis" + And I fill in "search-input" with "wikis" And I press "Search" Then I should see "50%" within "div.search-product-ecosol-percentage-icon-50" @@ -71,7 +75,7 @@ Feature: search products | wikis consultancy | development | true | | wikis consultancy | development | false | When I go to the search products page - And I fill in "query" with "wikis" + And I fill in "search-input" with "wikis" And I press "Search" Then I should see "75%" within "div.search-product-ecosol-percentage-icon-75" @@ -83,7 +87,7 @@ Feature: search products | wikis consultancy | development | false | | wikis consultancy | development | false | When I go to the search products page - And I fill in "query" with "wikis" + And I fill in "search-input" with "wikis" And I press "Search" Then I should see "25%" within "div.search-product-ecosol-percentage-icon-25" @@ -92,7 +96,7 @@ Feature: search products | owner | category | name | price | img | | colivre-ent | development | noosfero | 12.34 | noosfero-network | When I go to the search products page - And I fill in "query" with "noosfero" + And I fill in "search-input" with "noosfero" And I press "Search" Then I should not see "No image" And I should see "Zoom in" within "a.zoomify-image" @@ -105,7 +109,7 @@ Feature: search products | owner | name | category | | colivre-ent | Noosfero | software-livre | When I go to the search products page - And I fill in "query" with "software livre" + And I fill in "search-input" with "software livre" And I press "Search" Then I should see "Noosfero" within "#search-results" And I should not see "wikis consultancy" @@ -125,7 +129,7 @@ Feature: search products | owner | name | category | | art-pp | Arte em Madeira | solidaria | When I go to the search products page - And I fill in "query" with "Madeira" + And I fill in "search-input" with "Madeira" And I press "Search" Then I should see "Pres. Prudente" within "#facet-menu-f_region" And I should see ", SP" within "#facet-menu-f_region" @@ -145,7 +149,7 @@ Feature: search products | owner | name | category | | art-pp | Arte em Madeira | solidaria | When I go to the search products page - And I fill in "query" with "Prudente" + And I fill in "search-input" with "Prudente" And I press "Search" Then I should see "Arte em Madeira" within "#search-results" @@ -157,7 +161,7 @@ Feature: search products | owner | name | category | | colivre-ent | Noosfero Social Network Platform | software-livre | When I go to the search products page - And I fill in "query" with "Noosfero Network" + And I fill in "search-input" with "Noosfero Network" And I press "Search" Then I should see "Noosfero Social Network Platform" within "#search-results" @@ -177,7 +181,7 @@ Feature: search products | colivre-ent | Noosfero Network | software-livre | | fb | Facebook Network | big-brother | When I go to the search products page - And I fill in "query" with "Network" + And I fill in "search-input" with "Network" And I press "Search" And I follow "Software Livre" within "#facets-menu" Then I should see "Noosfero Network" within "#search-results" @@ -206,10 +210,10 @@ Feature: search products | other | Other open | software-livre | | other | Other closed | big-brother | When I go to the search products page - And I fill in "query" with "Network" + And I fill in "search-input" with "Network" And I press "Search" And I follow "Software Livre" within "#facets-menu" - And I fill in "query" with "Other" + And I fill in "search-input" with "Other" And I press "Search" Then I should see "Other open" within "#search-results" And I should not see "Other closed" @@ -217,4 +221,4 @@ Feature: search products Scenario: don't search when products are disabled in environment Given feature "disable_asset_products" is enabled on environment When I go to the search products page - Then I should not see content inside "#search-results" + Then I should see "There is no such page" within "#not-found" diff --git a/features/step_definitions/invitation_steps.rb b/features/step_definitions/invitation_steps.rb index 656ee86..e81f0bd 100644 --- a/features/step_definitions/invitation_steps.rb +++ b/features/step_definitions/invitation_steps.rb @@ -17,9 +17,3 @@ Given /^I invite email "(.+)" to be my friend$/ do |email| fill_in('mail_template', :with => 'Follow this link ') click_button("Invite my friends!") end - -Given /^there are no pending jobs$/ do - silence_stream(STDOUT) do - Delayed::Worker.new.work_off - end -end diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 461b3c8..d52c36e 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -422,6 +422,10 @@ Then /^The page title should contain "(.*)"$/ do |text| end end +Then /^The page should not contain "(.*)"$/ do |selector| + page.should have_no_css("#{selector}") +end + Given /^the mailbox is empty$/ do ActionMailer::Base.deliveries = [] end @@ -647,20 +651,26 @@ end When /^I search ([^\"]*) for "([^\"]*)"$/ do |asset, query| When %{I go to the search #{asset} page} - And %{I fill in "query" with "#{query}"} + And %{I fill in "search-input" with "#{query}"} And %{I press "Search"} end Then /^I should see ([^\"]*)'s product image$/ do |product_name| p = Product.find_by_name product_name - path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p, :only_path => true)) - response.should have_selector("div[class~=\"zoomable-image\"] a[href=\"http://#{path}\"]") + path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p)) + + with_scope('.zoomable-image') do + page.should have_xpath("a[@href=\"#{path}\"][@class='search-image-pic']") + end end Then /^I should not see ([^\"]*)'s product image$/ do |product_name| p = Product.find_by_name product_name - path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p, :only_path => true)) - response.should_not have_selector("div[class~=\"zoomable-image\"] a[href=\"http://#{path}\"]") + path = url_for(p.enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => p)) + + with_scope('.zoomable-image') do + page.should have_no_xpath("a[@href=\"#{path}\"][@class='search-image-pic']") + end end Then /^I should see ([^\"]*)'s profile image$/ do |name| @@ -738,3 +748,9 @@ Given /^the profile (.*) is configured to (.*) after login$/ do |profile, option profile.redirection_after_login = redirection profile.save end + +Given /^there are no pending jobs$/ do + silence_stream(STDOUT) do + Delayed::Worker.new.work_off + end +end -- libgit2 0.21.2