Fix regression tests after Dave broke them.

REL-1_X
Murtuza Zabuawala 2017-07-21 10:57:29 +01:00 committed by Dave Page
parent a49a3103e2
commit b313cbce0d
5 changed files with 30 additions and 35 deletions

View File

@ -103,7 +103,7 @@ class PGDataypeFeatureTest(BaseFeatureTest):
'922337203685.922337203685', '-92233720368547758.08',
'{1,2,3}', '{NaN,NaN,NaN}',
'Infinity', '{Infinity}',
r'[binary data]', r'[binary data[]]'
'binary data', 'binary data[]'
]
self.page.open_query_tool()

View File

@ -70,7 +70,6 @@ class QueryToolJourneyTest(BaseFeatureTest):
def _test_history_tab(self):
self.__clear_query_tool()
editor_input = self.page.find_by_id("output-panel")
self.page.click_element(editor_input)
self._execute_query("SELECT * FROM shoes")
@ -79,45 +78,47 @@ class QueryToolJourneyTest(BaseFeatureTest):
selected_history_entry = self.page.find_by_css_selector("#query_list .selected")
self.assertIn("SELECT * FROM shoes", selected_history_entry.text)
failed_history_detail_pane = self.page.find_by_id("query_detail")
self.assertIn("Error Message relation \"shoes\" does not exist", failed_history_detail_pane.text)
self.assertIn("ERROR: relation \"shoes\" does not exist", failed_history_detail_pane.text)
ActionChains(self.page.driver) \
.send_keys(Keys.ARROW_DOWN) \
.perform()
selected_history_entry = self.page.find_by_css_selector("#query_list .selected")
self.assertIn("SELECT * FROM test_table ORDER BY value", selected_history_entry.text)
selected_history_detail_pane = self.page.find_by_id("query_detail")
self.assertIn("SELECT * FROM test_table ORDER BY value", selected_history_detail_pane.text)
newly_selected_history_entry = self.page.find_by_xpath("//*[@id='query_list']/ul/li[1]")
self.page.click_element(newly_selected_history_entry)
selected_history_detail_pane = self.page.find_by_id("query_detail")
self.assertIn("SELECT * FROM shoes", selected_history_detail_pane.text)
self.__clear_query_tool()
self.page.click_element(editor_input)
for _ in range(15):
self._execute_query("SELECT * FROM hats")
self.page.click_tab("History")
query_we_need_to_scroll_to = self.page.find_by_xpath("//*[@id='query_list']/ul/li[17]")
self.page.click_element(query_we_need_to_scroll_to)
self._assert_not_clickable_because_out_of_view(query_we_need_to_scroll_to)
query_we_need_to_scroll_to = self.page.find_by_xpath(
"//*[@id='query_list']/ul/li[17]"
)
self._assert_not_clickable_because_out_of_view(
query_we_need_to_scroll_to
)
for _ in range(17):
ActionChains(self.page.driver) \
.send_keys(Keys.ARROW_DOWN) \
.perform()
self._assert_clickable(query_we_need_to_scroll_to)
def __clear_query_tool(self):
self.page.click_element(self.page.find_by_xpath("//*[@id='btn-edit']"))
self.page.click_element(
self.page.find_by_xpath("//*[@id='btn-clear-dropdown']")
)
ActionChains(self.driver)\
.move_to_element(self.page.find_by_xpath("//*[@id='btn-clear']"))\
.perform()
self.page.click_element(
self.page.find_by_xpath("//*[@id='btn-clear']")
)
self.page.click_modal('Yes')
def _navigate_to_query_tool(self):
@ -137,7 +138,7 @@ class QueryToolJourneyTest(BaseFeatureTest):
self.page.click_element(element)
def _assert_not_clickable_because_out_of_view(self, element):
self.assertRaises(self.page.click_element(element))
self.assertTrue(element.is_displayed())
def after(self):
self.page.close_query_tool()

View File

@ -169,14 +169,16 @@ class QueryToolFeatureTest(BaseFeatureTest):
self.page.toggle_open_tree_item('acceptance_test_db')
def _clear_query_tool(self):
# clear codemirror.
self.page.find_by_id("btn-edit").click()
# wait for alertify dialog open animation to complete.
time.sleep(1)
self.page.click_element(self.page.find_by_xpath("//button[contains(.,'Yes')]"))
# wait for alertify dialog close animation to complete.
time.sleep(1)
self.page.click_element(
self.page.find_by_xpath("//*[@id='btn-clear-dropdown']")
)
ActionChains(self.driver)\
.move_to_element(self.page.find_by_xpath("//*[@id='btn-clear']"))\
.perform()
self.page.click_element(
self.page.find_by_xpath("//*[@id='btn-clear']")
)
self.page.click_modal('Yes')
def _on_demand_result(self):
ON_DEMAND_CHUNKS = 2
@ -314,24 +316,16 @@ SELECT generate_series(1, 1000) as id order by id desc"""
SELECT generate_series(1, 1000) as id order by id desc"""
wait = WebDriverWait(self.page.driver, 10)
self.page.fill_codemirror_area_with(query)
query_op = self.page.find_by_id("btn-query-dropdown")
query_op.click()
ActionChains(self.driver).move_to_element(
query_op.find_element_by_xpath(
"//li[contains(.,'Explain Options')]")).perform()
self.page.find_by_id("btn-explain-verbose").click()
self.page.find_by_id("btn-explain").click()
self.page.wait_for_query_tool_loading_indicator_to_disappear()
self.page.click_tab('Data Output')
canvas = wait.until(EC.presence_of_element_located(
(By.CSS_SELECTOR, "#datagrid .slick-viewport .grid-canvas"))
)

View File

@ -239,7 +239,7 @@
</button>
</div>
<div class="btn-group" role="group" aria-label="">
<button id="btn-edit-dropdown" type="button" class="btn btn-default dropdown-toggle"
<button id="btn-clear-dropdown" type="button" class="btn btn-default dropdown-toggle"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
title="{{ _('Clear') }}" accesskey="l">
<i class="fa fa-eraser" aria-hidden="true"></i>

View File

@ -40,7 +40,7 @@ class AppStarter:
env=env
)
self.driver.set_window_size(1024, 1024)
self.driver.set_window_size(1280, 1024)
self.driver.get(
"http://" + self.app_config.DEFAULT_SERVER + ":" +
random_server_port)