Commit 71949171167cb709ac0673842d7c947c97bdd302

Authored by Rodrigo Souto
1 parent 0107c07b

manage-users-feature: add a sleep 1 on dialog confirmations

Don't know exactly why but adding this make all tests pass.
features/manage_users.feature
@@ -8,40 +8,40 @@ Background: @@ -8,40 +8,40 @@ Background:
8 | login | name | 8 | login | name |
9 | joaosilva | Joao Silva | 9 | joaosilva | Joao Silva |
10 | paulosantos | Paulo Santos | 10 | paulosantos | Paulo Santos |
11 - Given I am logged in as admin  
12 - Given I go to /admin/users 11 + And I am logged in as admin
  12 + And I go to /admin/users
13 13
14 @selenium 14 @selenium
15 Scenario: deactive user 15 Scenario: deactive user
16 - When I follow "Deactivate user" within "tr[title='Joao Silva']"  
17 - And I confirm the "Do you want to deactivate this user?" dialog 16 + Given I follow "Deactivate user" within "tr[title='Joao Silva']"
  17 + When I confirm the browser dialog
18 Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled 18 Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
19 19
20 @selenium 20 @selenium
21 Scenario: activate user 21 Scenario: activate user
22 Given I follow "Deactivate user" within "tr[title='Paulo Santos']" 22 Given I follow "Deactivate user" within "tr[title='Paulo Santos']"
23 - Given I confirm the "Do you want to deactivate this user?" dialog  
24 - When I follow "Activate user" within "tr[title='Paulo Santos']"  
25 - And I confirm the "Do you want to activate this user?" dialog 23 + And I confirm the browser dialog
  24 + And I follow "Activate user" within "tr[title='Paulo Santos']"
  25 + When I confirm the browser dialog
26 Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled 26 Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
27 27
28 @selenium 28 @selenium
29 Scenario: remove user 29 Scenario: remove user
30 - When I follow "Remove" within "tr[title='Joao Silva']"  
31 - And I confirm the "Do you want to remove this user?" dialog 30 + Given I follow "Remove" within "tr[title='Joao Silva']"
  31 + And I confirm the browser dialog
32 And I go to /admin/users 32 And I go to /admin/users
33 Then I should not see "Joao Silva" 33 Then I should not see "Joao Silva"
34 34
35 @selenium 35 @selenium
36 Scenario: admin user 36 Scenario: admin user
37 - When I follow "Set admin role" within "tr[title='Joao Silva']"  
38 - And I confirm the "Do you want to set this user as administrator?" dialog 37 + Given I follow "Set admin role" within "tr[title='Joao Silva']"
  38 + When I confirm the browser dialog
39 Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled 39 Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
40 40
41 @selenium 41 @selenium
42 Scenario: unadmin user 42 Scenario: unadmin user
43 Given I follow "Set admin role" within "tr[title='Paulo Santos']" 43 Given I follow "Set admin role" within "tr[title='Paulo Santos']"
44 - And I confirm the "Do you want to set this user as administrator?" dialog  
45 - When I follow "Reset admin role" within "tr[title='Paulo Santos']"  
46 - And I confirm the "Do you want to reset this user as administrator?" dialog 44 + And I confirm the browser dialog
  45 + And I follow "Reset admin role" within "tr[title='Paulo Santos']"
  46 + When I confirm the browser dialog
47 Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled 47 Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled
features/step_definitions/custom_web_steps.rb
@@ -43,6 +43,7 @@ end @@ -43,6 +43,7 @@ end
43 43
44 When /^I confirm the browser dialog$/ do 44 When /^I confirm the browser dialog$/ do
45 page.driver.browser.switch_to.alert.accept 45 page.driver.browser.switch_to.alert.accept
  46 + sleep 1 # FIXME Don't know why, but this is necessary... :/
46 end 47 end
47 48
48 When /^I type in "([^\"]*)" into autocomplete list "([^\"]*)" and I choose "([^\"]*)"$/ do |term, input, result| 49 When /^I type in "([^\"]*)" into autocomplete list "([^\"]*)" and I choose "([^\"]*)"$/ do |term, input, result|
features/step_definitions/noosfero_steps.rb
@@ -754,13 +754,6 @@ Given /^there are no pending jobs$/ do @@ -754,13 +754,6 @@ Given /^there are no pending jobs$/ do
754 end 754 end
755 end 755 end
756 756
757 -When /^I confirm the "(.*)" dialog$/ do |confirmation|  
758 - a = page.driver.browser.switch_to.alert  
759 - a.accept  
760 - # FIXME: a.text is returning nil  
761 - #assert_equal confirmation, a.text  
762 -end  
763 -  
764 Given /^the field (.*) is public for all users$/ do |field| 757 Given /^the field (.*) is public for all users$/ do |field|
765 Person.all.each do |person| 758 Person.all.each do |person|
766 person.fields_privacy = Hash.new if person.fields_privacy.nil? 759 person.fields_privacy = Hash.new if person.fields_privacy.nil?