From 25c5f7ea2540eff692dce595d72c25811d2b1eeb Mon Sep 17 00:00:00 2001 From: Gabriel Silva Date: Tue, 16 Feb 2016 13:57:30 +0000 Subject: [PATCH] Fixes Software Communities selenium tests --- src/noosfero-spb/software_communities/features/software_catalog.feature | 4 ++-- src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb | 28 +++++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/noosfero-spb/software_communities/features/software_catalog.feature b/src/noosfero-spb/software_communities/features/software_catalog.feature index 867029d..b04a2ca 100644 --- a/src/noosfero-spb/software_communities/features/software_catalog.feature +++ b/src/noosfero-spb/software_communities/features/software_catalog.feature @@ -40,7 +40,7 @@ Feature: Search software And I fill in "search-input" with "One" And I keyup on selector "#search-input" Then I should see "Software One" - Then I should not see "Software Two" + And I should not see "Software Two" @selenium Scenario: Show software ordered by name when "Name A-Z" is selected @@ -101,7 +101,7 @@ Feature: Search software And the environment domain is "localhost" And I am logged in as "joaosilva" And I go to /profile/software-two/plugin/organization_ratings/new_rating - And I press "Enviar" + And I press "Save" And I go to /search/software_infos When I select "Rating" from "sort" And I sleep for 3 seconds diff --git a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb index c7e1b42..1084eff 100644 --- a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb +++ b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb @@ -246,18 +246,21 @@ end Given /^I am logged in as mpog_admin$/ do visit('/account/logout') + user = User.find_by_login('admin_user') - user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') - person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" - user.person = person - user.save! + unless user + user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') + person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" + user.person = person + user.save! - person.user_id = user.id - person.save! + person.user_id = user.id + person.save! - user.activate - e = Environment.default - e.add_admin(user.person) + user.activate + e = Environment.default + e.add_admin(user.person) + end visit('/account/login') fill_in("Username", :with => user.login) @@ -266,12 +269,12 @@ Given /^I am logged in as mpog_admin$/ do end Given /^I should see "([^"]*)" before "([^"]*)"$/ do |before, after| - assert page.body.index("#{before}") < page.body.index("#{after}") + expect(page.body.index("#{before}")).to be < page.body.index("#{after}") end Given /^I keyup on selector "([^"]*)"$/ do |selector| selector_founded = evaluate_script("jQuery('#{selector}').trigger('keyup').length != 0") - selector_founded.should be_true + selector_founded.should be true end Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| @@ -283,6 +286,5 @@ Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| end Given /^I should see "([^"]*)" in the page/ do |message| - match = page.body =~ /#{message}/ - match.should_not be nil + expect(page.body =~ /#{message}/).not_to be nil end -- libgit2 0.21.2