From 2abff8f5d4d4098ff456e34dfca76c53cc895b41 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Mon, 19 Mar 2018 13:23:29 +0000 Subject: [PATCH] Use a common function for sever setup in the testsuite. --- .../xss_checks_pgadmin_debugger_test.py | 2 +- .../xss_checks_roles_control_test.py | 26 ++----------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py index 24a463b0d..17ce61532 100644 --- a/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py +++ b/web/pgadmin/feature_tests/xss_checks_pgadmin_debugger_test.py @@ -43,9 +43,9 @@ class CheckDebuggerForXssFeatureTest(BaseFeatureTest): self._debug_function() def after(self): + self.page.remove_server(self.server) test_utils.drop_debug_function(self.server, "postgres", "a_test_function") - self.page.remove_server(self.server) def _function_node_expandable(self): self.page.toggle_open_server(self.server['name']) diff --git a/web/pgadmin/feature_tests/xss_checks_roles_control_test.py b/web/pgadmin/feature_tests/xss_checks_roles_control_test.py index 36f5aa6ba..21a202732 100644 --- a/web/pgadmin/feature_tests/xss_checks_roles_control_test.py +++ b/web/pgadmin/feature_tests/xss_checks_roles_control_test.py @@ -34,38 +34,16 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest): def runTest(self): self.page.wait_for_spinner_to_disappear() - self._connects_to_server() + self.page.add_server(self.server) self._role_node_expandable() self._check_role_membership_control() def after(self): + self.page.remove_server(self.server) test_utils.drop_role(self.server, "postgres", "test_role") test_utils.drop_role(self.server, "postgres", "

test

") - self.page.remove_server(self.server) - - def _connects_to_server(self): - self.page.find_by_xpath( - "//*[@class='aciTreeText' and .='Servers']").click() - self.page.driver.find_element_by_link_text("Object").click() - ActionChains( - self.page.driver - ).move_to_element( - self.page.driver.find_element_by_link_text("Create") - ).perform() - self.page.find_by_partial_link_text("Server...").click() - - server_config = self.server - self.page.fill_input_by_field_name("name", server_config['name']) - self.page.find_by_partial_link_text("Connection").click() - self.page.fill_input_by_field_name("host", server_config['host']) - self.page.fill_input_by_field_name("port", server_config['port']) - self.page.fill_input_by_field_name( - "username", server_config['username']) - self.page.fill_input_by_field_name( - "password", server_config['db_password']) - self.page.find_by_xpath("//button[contains(.,'Save')]").click() def _role_node_expandable(self): self.page.toggle_open_server(self.server['name'])