mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 15:26:46 -06:00
Reset query tool options before running tests. Fixes #2681
This commit is contained in:
parent
c4393a7795
commit
263aa42725
@ -41,6 +41,7 @@ class QueryToolFeatureTest(BaseFeatureTest):
|
||||
self.page.add_server(self.server)
|
||||
self._locate_database_tree_node()
|
||||
self.page.open_query_tool()
|
||||
self._reset_options()
|
||||
|
||||
def runTest(self):
|
||||
# on demand result set on scrolling.
|
||||
@ -97,6 +98,33 @@ class QueryToolFeatureTest(BaseFeatureTest):
|
||||
self.server['sslmode'])
|
||||
test_utils.drop_database(connection, "acceptance_test_db")
|
||||
|
||||
def _reset_options(self):
|
||||
# this will set focus to correct iframe.
|
||||
self.page.fill_codemirror_area_with('')
|
||||
|
||||
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()
|
||||
|
||||
# disable Explain options and auto rollback only if they are enabled.
|
||||
for op in ('explain-verbose', 'explain-costs',
|
||||
'explain-buffers', 'explain-timing', 'auto-rollback'):
|
||||
btn = self.page.find_by_id("btn-{}".format(op))
|
||||
check = btn.find_element_by_tag_name('i')
|
||||
if 'visibility-hidden' not in check.get_attribute('class'):
|
||||
btn.click()
|
||||
|
||||
# enable autocommit only if it's disabled
|
||||
btn = self.page.find_by_id("btn-auto-commit")
|
||||
check = btn.find_element_by_tag_name('i')
|
||||
if 'visibility-hidden' in check.get_attribute('class'):
|
||||
btn.click()
|
||||
|
||||
# close menu
|
||||
query_op.click()
|
||||
|
||||
def _locate_database_tree_node(self):
|
||||
self.page.toggle_open_tree_item(self.server['name'])
|
||||
self.page.toggle_open_tree_item('Databases')
|
||||
|
Loading…
Reference in New Issue
Block a user