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 8 | login | name |
9 9 | joaosilva | Joao Silva |
10 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 14 @selenium
15 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 18 Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
19 19  
20 20 @selenium
21 21 Scenario: activate user
22 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 26 Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
27 27  
28 28 @selenium
29 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 32 And I go to /admin/users
33 33 Then I should not see "Joao Silva"
34 34  
35 35 @selenium
36 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 39 Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
40 40  
41 41 @selenium
42 42 Scenario: unadmin user
43 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 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 43  
44 44 When /^I confirm the browser dialog$/ do
45 45 page.driver.browser.switch_to.alert.accept
  46 + sleep 1 # FIXME Don't know why, but this is necessary... :/
46 47 end
47 48  
48 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 754 end
755 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 757 Given /^the field (.*) is public for all users$/ do |field|
765 758 Person.all.each do |person|
766 759 person.fields_privacy = Hash.new if person.fields_privacy.nil?
... ...