[Git][noosfero/noosfero][master] manage-users-feature: add a sleep 1 on dialog confirmations

Rodrigo Souto gitlab at mg.gitlab.com
Tue Jan 26 17:35:49 BRST 2016


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
71949171 by Rodrigo Souto at 2016-01-26T16:35:01-03:00
manage-users-feature: add a sleep 1 on dialog confirmations

Don't know exactly why but adding this make all tests pass.

- - - - -


3 changed files:

- features/manage_users.feature
- features/step_definitions/custom_web_steps.rb
- features/step_definitions/noosfero_steps.rb


Changes:

=====================================
features/manage_users.feature
=====================================
--- a/features/manage_users.feature
+++ b/features/manage_users.feature
@@ -8,40 +8,40 @@ Background:
     | login       | name         |
     | joaosilva   | Joao Silva   |
     | paulosantos | Paulo Santos |
-  Given I am logged in as admin
-  Given I go to /admin/users
+  And I am logged in as admin
+  And I go to /admin/users
 
   @selenium
   Scenario: deactive user
-    When I follow "Deactivate user" within "tr[title='Joao Silva']"
-    And I confirm the "Do you want to deactivate this user?" dialog
+    Given I follow "Deactivate user" within "tr[title='Joao Silva']"
+    When I confirm the browser dialog
     Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
 
   @selenium
   Scenario: activate user
     Given I follow "Deactivate user" within "tr[title='Paulo Santos']"
-    Given I confirm the "Do you want to deactivate this user?" dialog
-    When I follow "Activate user" within "tr[title='Paulo Santos']"
-    And I confirm the "Do you want to activate this user?" dialog
+    And I confirm the browser dialog
+    And I follow "Activate user" within "tr[title='Paulo Santos']"
+    When I confirm the browser dialog
     Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
 
   @selenium
   Scenario: remove user
-    When I follow "Remove" within "tr[title='Joao Silva']"
-    And I confirm the "Do you want to remove this user?" dialog
+    Given I follow "Remove" within "tr[title='Joao Silva']"
+    And I confirm the browser dialog
     And I go to /admin/users
     Then I should not see "Joao Silva"
 
   @selenium
   Scenario: admin user
-    When I follow "Set admin role" within "tr[title='Joao Silva']"
-    And I confirm the "Do you want to set this user as administrator?" dialog
+    Given I follow "Set admin role" within "tr[title='Joao Silva']"
+    When I confirm the browser dialog
     Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
 
   @selenium
   Scenario: unadmin user
     Given I follow "Set admin role" within "tr[title='Paulo Santos']"
-    And I confirm the "Do you want to set this user as administrator?" dialog
-    When I follow "Reset admin role" within "tr[title='Paulo Santos']"
-    And I confirm the "Do you want to reset this user as administrator?" dialog
+    And I confirm the browser dialog
+    And I follow "Reset admin role" within "tr[title='Paulo Santos']"
+    When I confirm the browser dialog
     Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled


=====================================
features/step_definitions/custom_web_steps.rb
=====================================
--- a/features/step_definitions/custom_web_steps.rb
+++ b/features/step_definitions/custom_web_steps.rb
@@ -43,6 +43,7 @@ end
 
 When /^I confirm the browser dialog$/ do
   page.driver.browser.switch_to.alert.accept
+  sleep 1 # FIXME Don't know why, but this is necessary...  :/
 end
 
 When /^I type in "([^\"]*)" into autocomplete list "([^\"]*)" and I choose "([^\"]*)"$/ do |term, input, result|


=====================================
features/step_definitions/noosfero_steps.rb
=====================================
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -754,13 +754,6 @@ Given /^there are no pending jobs$/ do
   end
 end
 
-When /^I confirm the "(.*)" dialog$/ do |confirmation|
-  a = page.driver.browser.switch_to.alert
-  a.accept
-  # FIXME: a.text is returning nil
-  #assert_equal confirmation, a.text
-end
-
 Given /^the field (.*) is public for all users$/ do |field|
   Person.all.each do |person|
     person.fields_privacy = Hash.new if person.fields_privacy.nil?



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/71949171167cb709ac0673842d7c947c97bdd302
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160126/52c5d16f/attachment.html>


More information about the Noosfero-dev mailing list