Commit 25c5f7ea2540eff692dce595d72c25811d2b1eeb
1 parent
b77d7861
Exists in
spb_to_rails4
Fixes Software Communities selenium tests
Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
2 changed files
with
17 additions
and
15 deletions
Show diff stats
src/noosfero-spb/software_communities/features/software_catalog.feature
@@ -40,7 +40,7 @@ Feature: Search software | @@ -40,7 +40,7 @@ Feature: Search software | ||
40 | And I fill in "search-input" with "One" | 40 | And I fill in "search-input" with "One" |
41 | And I keyup on selector "#search-input" | 41 | And I keyup on selector "#search-input" |
42 | Then I should see "Software One" | 42 | Then I should see "Software One" |
43 | - Then I should not see "Software Two" | 43 | + And I should not see "Software Two" |
44 | 44 | ||
45 | @selenium | 45 | @selenium |
46 | Scenario: Show software ordered by name when "Name A-Z" is selected | 46 | Scenario: Show software ordered by name when "Name A-Z" is selected |
@@ -101,7 +101,7 @@ Feature: Search software | @@ -101,7 +101,7 @@ Feature: Search software | ||
101 | And the environment domain is "localhost" | 101 | And the environment domain is "localhost" |
102 | And I am logged in as "joaosilva" | 102 | And I am logged in as "joaosilva" |
103 | And I go to /profile/software-two/plugin/organization_ratings/new_rating | 103 | And I go to /profile/software-two/plugin/organization_ratings/new_rating |
104 | - And I press "Enviar" | 104 | + And I press "Save" |
105 | And I go to /search/software_infos | 105 | And I go to /search/software_infos |
106 | When I select "Rating" from "sort" | 106 | When I select "Rating" from "sort" |
107 | And I sleep for 3 seconds | 107 | And I sleep for 3 seconds |
src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb
@@ -246,18 +246,21 @@ end | @@ -246,18 +246,21 @@ end | ||
246 | 246 | ||
247 | Given /^I am logged in as mpog_admin$/ do | 247 | Given /^I am logged in as mpog_admin$/ do |
248 | visit('/account/logout') | 248 | visit('/account/logout') |
249 | + user = User.find_by_login('admin_user') | ||
249 | 250 | ||
250 | - user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') | ||
251 | - person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" | ||
252 | - user.person = person | ||
253 | - user.save! | 251 | + unless user |
252 | + user = User.new(:login => 'admin_user', :password => '123456', :password_confirmation => '123456', :email => 'admin_user@example.com') | ||
253 | + person = Person.new :name=>"Mpog Admin", :identifier=>"mpog-admin" | ||
254 | + user.person = person | ||
255 | + user.save! | ||
254 | 256 | ||
255 | - person.user_id = user.id | ||
256 | - person.save! | 257 | + person.user_id = user.id |
258 | + person.save! | ||
257 | 259 | ||
258 | - user.activate | ||
259 | - e = Environment.default | ||
260 | - e.add_admin(user.person) | 260 | + user.activate |
261 | + e = Environment.default | ||
262 | + e.add_admin(user.person) | ||
263 | + end | ||
261 | 264 | ||
262 | visit('/account/login') | 265 | visit('/account/login') |
263 | fill_in("Username", :with => user.login) | 266 | fill_in("Username", :with => user.login) |
@@ -266,12 +269,12 @@ Given /^I am logged in as mpog_admin$/ do | @@ -266,12 +269,12 @@ Given /^I am logged in as mpog_admin$/ do | ||
266 | end | 269 | end |
267 | 270 | ||
268 | Given /^I should see "([^"]*)" before "([^"]*)"$/ do |before, after| | 271 | Given /^I should see "([^"]*)" before "([^"]*)"$/ do |before, after| |
269 | - assert page.body.index("#{before}") < page.body.index("#{after}") | 272 | + expect(page.body.index("#{before}")).to be < page.body.index("#{after}") |
270 | end | 273 | end |
271 | 274 | ||
272 | Given /^I keyup on selector "([^"]*)"$/ do |selector| | 275 | Given /^I keyup on selector "([^"]*)"$/ do |selector| |
273 | selector_founded = evaluate_script("jQuery('#{selector}').trigger('keyup').length != 0") | 276 | selector_founded = evaluate_script("jQuery('#{selector}').trigger('keyup').length != 0") |
274 | - selector_founded.should be_true | 277 | + selector_founded.should be true |
275 | end | 278 | end |
276 | 279 | ||
277 | Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| | 280 | Then /^there should be (\d+) divs? with class "([^"]*)"$/ do |count, klass| |
@@ -283,6 +286,5 @@ Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| | @@ -283,6 +286,5 @@ Then /^I should see "([^"]*)" in "([^"]*)" field$/ do |content, field| | ||
283 | end | 286 | end |
284 | 287 | ||
285 | Given /^I should see "([^"]*)" in the page/ do |message| | 288 | Given /^I should see "([^"]*)" in the page/ do |message| |
286 | - match = page.body =~ /#{message}/ | ||
287 | - match.should_not be nil | 289 | + expect(page.body =~ /#{message}/).not_to be nil |
288 | end | 290 | end |