Wait for the Tools menu to be populated when running the feature tests, instead of failing.
Fix by Khushboo, based on Harshal's previous work.REL-1_X
parent
92b1b1365e
commit
6b6d3369b3
|
@ -102,9 +102,7 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
||||||
r'\336\255\276\357', r'{"\\336\\255\\276\\357","\\336\\255\\276\\357"}'
|
r'\336\255\276\357', r'{"\\336\\255\\276\\357","\\336\\255\\276\\357"}'
|
||||||
]
|
]
|
||||||
|
|
||||||
self.page.driver.find_element_by_link_text("Tools").click()
|
self.page.open_query_tool()
|
||||||
self.page.find_by_partial_link_text("Query Tool").click()
|
|
||||||
|
|
||||||
self.page.fill_codemirror_area_with(query)
|
self.page.fill_codemirror_area_with(query)
|
||||||
self.page.find_by_id("btn-flash").click()
|
self.page.find_by_id("btn-flash").click()
|
||||||
wait = WebDriverWait(self.page.driver, 5)
|
wait = WebDriverWait(self.page.driver, 5)
|
||||||
|
|
|
@ -87,10 +87,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
|
||||||
self.page.toggle_open_tree_item(self.server['name'])
|
self.page.toggle_open_tree_item(self.server['name'])
|
||||||
self.page.toggle_open_tree_item('Databases')
|
self.page.toggle_open_tree_item('Databases')
|
||||||
self.page.toggle_open_tree_item('acceptance_test_db')
|
self.page.toggle_open_tree_item('acceptance_test_db')
|
||||||
time.sleep(5)
|
self.page.open_query_tool()
|
||||||
self.page.find_by_partial_link_text("Tools").click()
|
|
||||||
self.page.find_by_partial_link_text("Query Tool").click()
|
|
||||||
self.page.click_tab('Query -')
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
def _execute_query(self, query):
|
def _execute_query(self, query):
|
||||||
|
|
|
@ -95,7 +95,6 @@ CREATE TABLE public.defaults
|
||||||
self.page.wait_for_spinner_to_disappear()
|
self.page.wait_for_spinner_to_disappear()
|
||||||
self.page.add_server(self.server)
|
self.page.add_server(self.server)
|
||||||
self._tables_node_expandable()
|
self._tables_node_expandable()
|
||||||
self.driver.switch_to.default_content()
|
|
||||||
self.page.select_tree_item('defaults')
|
self.page.select_tree_item('defaults')
|
||||||
# Open Object -> View data
|
# Open Object -> View data
|
||||||
self._view_data_grid()
|
self._view_data_grid()
|
||||||
|
|
|
@ -62,6 +62,33 @@ class PgadminPage:
|
||||||
|
|
||||||
self.find_by_xpath("//*[@id='tree']//*[.='" + server_config['name'] + "']")
|
self.find_by_xpath("//*[@id='tree']//*[.='" + server_config['name'] + "']")
|
||||||
|
|
||||||
|
def open_query_tool(self):
|
||||||
|
self.driver.find_element_by_link_text("Tools").click()
|
||||||
|
tools_menu = self.driver.find_element_by_id('mnu_tools')
|
||||||
|
|
||||||
|
# Query Tool is first li
|
||||||
|
query_tool = tools_menu.find_element_by_tag_name('li')
|
||||||
|
|
||||||
|
self.enable_menu_item(query_tool, 10)
|
||||||
|
|
||||||
|
self.find_by_partial_link_text("Query Tool").click()
|
||||||
|
self.click_tab('Query -')
|
||||||
|
|
||||||
|
def enable_menu_item(self, menu_item, wait_time):
|
||||||
|
start_time = time.time()
|
||||||
|
# wait until menu becomes enabled.
|
||||||
|
while time.time() - start_time < wait_time: # wait_time seconds
|
||||||
|
# if menu is disabled then it will have
|
||||||
|
# two classes 'menu-item disabled'.
|
||||||
|
# And if menu is enabled the it will have
|
||||||
|
# only one class 'menu-item'.
|
||||||
|
|
||||||
|
if 'menu-item' == str(menu_item.get_attribute('class')):
|
||||||
|
break
|
||||||
|
time.sleep(0.1)
|
||||||
|
else:
|
||||||
|
assert False, "'Tools -> Query Tool' menu did not enable."
|
||||||
|
|
||||||
def close_query_tool(self):
|
def close_query_tool(self):
|
||||||
self.driver.switch_to.default_content()
|
self.driver.switch_to.default_content()
|
||||||
tab = self.find_by_xpath("//*[contains(@class,'wcPanelTab') and contains(.,'" + "Query" + "')]")
|
tab = self.find_by_xpath("//*[contains(@class,'wcPanelTab') and contains(.,'" + "Query" + "')]")
|
||||||
|
|
Loading…
Reference in New Issue