From 2ae3ed1c5a33f340c9b07a5558d8c820b6bbe88b Mon Sep 17 00:00:00 2001 From: Juan David Mendez Solano Date: Fri, 20 Mar 2020 21:42:25 +0100 Subject: [PATCH 1/5] Implementation of Selenium test for signout from user preferences --- lib/galaxy/selenium/navigation.yml | 1 + lib/galaxy_test/selenium/test_sign_out.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 lib/galaxy_test/selenium/test_sign_out.py diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index f35dab23a0b..50f81ed5016 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -70,6 +70,7 @@ masthead: preferences: selectors: + sign_out: "#edit-preferences-custom-builds" change_password: "#edit-preferences-password" manage_information: '#edit-preferences-information' current_email: "#user-preferences-current-email" diff --git a/lib/galaxy_test/selenium/test_sign_out.py b/lib/galaxy_test/selenium/test_sign_out.py new file mode 100644 index 00000000000..9a160bef9ac --- /dev/null +++ b/lib/galaxy_test/selenium/test_sign_out.py @@ -0,0 +1,22 @@ +from .framework import ( + selenium_test, + SeleniumTestCase +) + + +class SignOutTestCase(SeleniumTestCase): + @selenium_test + def test_sign_out(self): + email = self._get_random_email() + self.register(email) + self.click_masthead_user() + self.components.masthead.preferences.wait_for_and_click() + self.components.preferences.sign_out.wait_for_and_click() + cancel_button = self.driver.find_element_by_xpath("//button[@id='button-0']") + cancel_button.click() + assert self.is_logged_in() + new_email = self.driver.find_element_by_id("user-preferences-current-email").text + self.assertTrue(email == new_email) + signout_button = self.driver.find_element_by_xpath("//button[@id='button-1']") + signout_button.click() + assert not self.is_logged_in() From 9d4f6ab0cde15e3dd5106568496d7b0590e0a1cf Mon Sep 17 00:00:00 2001 From: Juan David Mendez Solano Date: Fri, 20 Mar 2020 22:57:57 +0100 Subject: [PATCH 2/5] Change id link id from custome-builds into sign-out --- client/galaxy/scripts/components/User/UserPreferencesModel.js | 2 +- lib/galaxy/selenium/navigation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/galaxy/scripts/components/User/UserPreferencesModel.js b/client/galaxy/scripts/components/User/UserPreferencesModel.js index 702d038ae39..847c0b226c8 100644 --- a/client/galaxy/scripts/components/User/UserPreferencesModel.js +++ b/client/galaxy/scripts/components/User/UserPreferencesModel.js @@ -83,7 +83,7 @@ export const getUserPreferencesModel = () => { }, logout: { title: _l("Sign Out"), - id: "edit-preferences-custom-builds", + id: "edit-preferences-sign-out", description: _l("Click here to sign out of all sessions."), icon: "fa-sign-out", shouldRender: !!Galaxy.session_csrf_token diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index 50f81ed5016..9e4b125817f 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -70,7 +70,7 @@ masthead: preferences: selectors: - sign_out: "#edit-preferences-custom-builds" + sign_out: "#edit-preferences-sign-out" change_password: "#edit-preferences-password" manage_information: '#edit-preferences-information' current_email: "#user-preferences-current-email" From fa87cd0801f7af3e505889ed88a9fd9060794c17 Mon Sep 17 00:00:00 2001 From: Juan David Mendez Solano Date: Mon, 30 Mar 2020 17:54:06 +0200 Subject: [PATCH 3/5] Possible example of errors not showing --- lib/galaxy/selenium/navigation.yml | 5 +++++ lib/galaxy_test/selenium/test_sign_out.py | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index 9e4b125817f..9ade81de4a2 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -89,6 +89,11 @@ change_user_address: type: xpath selector: '//span[contains(text(), "Insert Address")]' +sign_out: + selectors: + cancel_button: '.modal-footer .buttons #button-0' + sign_out_button: '.modal-footer .buttons #button-0' + history_panel: menu: labels: diff --git a/lib/galaxy_test/selenium/test_sign_out.py b/lib/galaxy_test/selenium/test_sign_out.py index 9a160bef9ac..1fecc571f85 100644 --- a/lib/galaxy_test/selenium/test_sign_out.py +++ b/lib/galaxy_test/selenium/test_sign_out.py @@ -1,3 +1,4 @@ +import time from .framework import ( selenium_test, SeleniumTestCase @@ -12,11 +13,17 @@ class SignOutTestCase(SeleniumTestCase): self.click_masthead_user() self.components.masthead.preferences.wait_for_and_click() self.components.preferences.sign_out.wait_for_and_click() - cancel_button = self.driver.find_element_by_xpath("//button[@id='button-0']") - cancel_button.click() + #Testing of the cancel button + time.sleep(5) + self.components.sign_out.cancel_button.wait_for_and_click() + time.sleep(10) #Giving time to click cancel and go back to user preferences (not happening, and no error) assert self.is_logged_in() new_email = self.driver.find_element_by_id("user-preferences-current-email").text self.assertTrue(email == new_email) - signout_button = self.driver.find_element_by_xpath("//button[@id='button-1']") - signout_button.click() - assert not self.is_logged_in() + #Testing of the sign out button + self.components.preferences.sign_out.wait_for_and_click() + time.sleep(5) + self.components.sign_out.sign_out_button.wait_for_and_click() + time.sleep(10) # Enough time to see a log out screen and redirection + # assert not self.is_logged_in() # Error only shows here, but should had been trigger in line 17 + time.sleep(5) \ No newline at end of file From 2e31db8b49c27a74a8dbc1bb3bd56a899b985d9c Mon Sep 17 00:00:00 2001 From: Juan David Mendez Solano Date: Mon, 30 Mar 2020 18:34:41 +0200 Subject: [PATCH 4/5] Implementation of the Sign out from user preference selenium test --- lib/galaxy/selenium/navigation.yml | 2 +- lib/galaxy_test/selenium/test_sign_out.py | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index 9ade81de4a2..859250ea708 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -92,7 +92,7 @@ change_user_address: sign_out: selectors: cancel_button: '.modal-footer .buttons #button-0' - sign_out_button: '.modal-footer .buttons #button-0' + sign_out_button: '.modal-footer .buttons #button-1' history_panel: menu: diff --git a/lib/galaxy_test/selenium/test_sign_out.py b/lib/galaxy_test/selenium/test_sign_out.py index 1fecc571f85..928c61d23c1 100644 --- a/lib/galaxy_test/selenium/test_sign_out.py +++ b/lib/galaxy_test/selenium/test_sign_out.py @@ -1,4 +1,3 @@ -import time from .framework import ( selenium_test, SeleniumTestCase @@ -13,17 +12,10 @@ class SignOutTestCase(SeleniumTestCase): self.click_masthead_user() self.components.masthead.preferences.wait_for_and_click() self.components.preferences.sign_out.wait_for_and_click() - #Testing of the cancel button - time.sleep(5) self.components.sign_out.cancel_button.wait_for_and_click() - time.sleep(10) #Giving time to click cancel and go back to user preferences (not happening, and no error) assert self.is_logged_in() new_email = self.driver.find_element_by_id("user-preferences-current-email").text self.assertTrue(email == new_email) - #Testing of the sign out button self.components.preferences.sign_out.wait_for_and_click() - time.sleep(5) self.components.sign_out.sign_out_button.wait_for_and_click() - time.sleep(10) # Enough time to see a log out screen and redirection - # assert not self.is_logged_in() # Error only shows here, but should had been trigger in line 17 - time.sleep(5) \ No newline at end of file + assert not self.is_logged_in() \ No newline at end of file From e26e8d3c0b339a6a9a63baf9df9db47540ae4c0d Mon Sep 17 00:00:00 2001 From: Juan David Mendez Solano Date: Mon, 30 Mar 2020 18:34:41 +0200 Subject: [PATCH 5/5] Implementation of the Sign out from user preference selenium test --- lib/galaxy/selenium/navigation.yml | 2 +- lib/galaxy_test/selenium/test_sign_out.py | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index 9ade81de4a2..859250ea708 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -92,7 +92,7 @@ change_user_address: sign_out: selectors: cancel_button: '.modal-footer .buttons #button-0' - sign_out_button: '.modal-footer .buttons #button-0' + sign_out_button: '.modal-footer .buttons #button-1' history_panel: menu: diff --git a/lib/galaxy_test/selenium/test_sign_out.py b/lib/galaxy_test/selenium/test_sign_out.py index 1fecc571f85..928c61d23c1 100644 --- a/lib/galaxy_test/selenium/test_sign_out.py +++ b/lib/galaxy_test/selenium/test_sign_out.py @@ -1,4 +1,3 @@ -import time from .framework import ( selenium_test, SeleniumTestCase @@ -13,17 +12,10 @@ class SignOutTestCase(SeleniumTestCase): self.click_masthead_user() self.components.masthead.preferences.wait_for_and_click() self.components.preferences.sign_out.wait_for_and_click() - #Testing of the cancel button - time.sleep(5) self.components.sign_out.cancel_button.wait_for_and_click() - time.sleep(10) #Giving time to click cancel and go back to user preferences (not happening, and no error) assert self.is_logged_in() new_email = self.driver.find_element_by_id("user-preferences-current-email").text self.assertTrue(email == new_email) - #Testing of the sign out button self.components.preferences.sign_out.wait_for_and_click() - time.sleep(5) self.components.sign_out.sign_out_button.wait_for_and_click() - time.sleep(10) # Enough time to see a log out screen and redirection - # assert not self.is_logged_in() # Error only shows here, but should had been trigger in line 17 - time.sleep(5) \ No newline at end of file + assert not self.is_logged_in() \ No newline at end of file