From ec476d62742b5575dfddbec15ef20b397505e728 Mon Sep 17 00:00:00 2001 From: Shubham Agarwal Date: Wed, 27 Jun 2018 16:40:03 +0100 Subject: [PATCH] Feature test reliability improvements: 1. click_tab() -> Added wait till element is clickable, test cases are failing since the function attempts to click the tab which is not yet in the state to be clicked. 2. add_server() -> Replaced the sleep statement with wait till element to be clickable. --- web/regression/feature_utils/pgadmin_page.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py index 4b6bc21c3..ed5ad7014 100644 --- a/web/regression/feature_utils/pgadmin_page.py +++ b/web/regression/feature_utils/pgadmin_page.py @@ -60,9 +60,9 @@ class PgadminPage: self.fill_input_by_field_name("port", server_config['port']) self.fill_input_by_field_name("username", server_config['username']) self.fill_input_by_field_name("password", server_config['db_password']) - # Required sleep to avoid "fe_sendauth" password error. - time.sleep(0.5) - self.find_by_xpath("//button[contains(.,'Save')]").click() + WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable( + (By.CSS_SELECTOR, "button[type='save'].btn.btn-primary"))) + self.find_by_css_selector("button[type='save'].btn.btn-primary").click() self.find_by_xpath( "//*[@id='tree']//*[.='" + server_config['name'] + "']") @@ -235,6 +235,11 @@ class PgadminPage: action.perform() def click_tab(self, tab_name): + WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable( + (By.XPATH, "//*[contains(@class,'wcTabTop')]//" + "*[contains(@class,'wcPanelTab') " + "and contains(.,'" + tab_name + "')]"))) + tab = self.find_by_xpath("//*[contains(@class,'wcTabTop')]//" "*[contains(@class,'wcPanelTab') " "and contains(.,'" + tab_name + "')]")