mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-24 08:00:09 -06:00
Fixed feature tests.
This commit is contained in:
parent
74f7fee8b5
commit
95f63f6af8
@ -118,9 +118,9 @@ class QueryToolFeatureTest(BaseFeatureTest):
|
|||||||
# this will set focus to correct iframe.
|
# this will set focus to correct iframe.
|
||||||
self.page.fill_codemirror_area_with('')
|
self.page.fill_codemirror_area_with('')
|
||||||
|
|
||||||
explain_op = self.page.find_by_css_selector(
|
self.page.retry_click(
|
||||||
QueryToolLocators.btn_explain_options_dropdown)
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_options_dropdown),
|
||||||
explain_op.click()
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_verbose))
|
||||||
|
|
||||||
# disable Explain options and auto rollback only if they are enabled.
|
# disable Explain options and auto rollback only if they are enabled.
|
||||||
for op in (QueryToolLocators.btn_explain_verbose,
|
for op in (QueryToolLocators.btn_explain_verbose,
|
||||||
@ -261,17 +261,15 @@ SELECT generate_series(1, 1000) as id order by id desc"""
|
|||||||
|
|
||||||
self.page.fill_codemirror_area_with(query)
|
self.page.fill_codemirror_area_with(query)
|
||||||
|
|
||||||
explain_op = self.page.find_by_css_selector(
|
self.page.retry_click(
|
||||||
QueryToolLocators.btn_explain_options_dropdown)
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_options_dropdown),
|
||||||
explain_op.click()
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_verbose))
|
||||||
|
|
||||||
# disable Explain options and auto rollback only if they are enabled.
|
# disable Explain options and auto rollback only if they are enabled.
|
||||||
for op in (QueryToolLocators.btn_explain_verbose,
|
for op in (QueryToolLocators.btn_explain_verbose,
|
||||||
QueryToolLocators.btn_explain_costs):
|
QueryToolLocators.btn_explain_costs):
|
||||||
self.page.find_by_css_selector(op).click()
|
self.page.find_by_css_selector(op).click()
|
||||||
|
|
||||||
explain_op.click()
|
|
||||||
|
|
||||||
self.page.find_by_css_selector(
|
self.page.find_by_css_selector(
|
||||||
QueryToolLocators.btn_explain).click()
|
QueryToolLocators.btn_explain).click()
|
||||||
|
|
||||||
@ -299,17 +297,15 @@ SELECT generate_series(1, 1000) as id order by id desc"""
|
|||||||
|
|
||||||
self.page.fill_codemirror_area_with(query)
|
self.page.fill_codemirror_area_with(query)
|
||||||
|
|
||||||
explain_op = self.page.find_by_css_selector(
|
self.page.retry_click(
|
||||||
QueryToolLocators.btn_explain_options_dropdown)
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_options_dropdown),
|
||||||
explain_op.click()
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_verbose))
|
||||||
|
|
||||||
# disable Explain options and auto rollback only if they are enabled.
|
# disable Explain options and auto rollback only if they are enabled.
|
||||||
for op in (QueryToolLocators.btn_explain_buffers,
|
for op in (QueryToolLocators.btn_explain_buffers,
|
||||||
QueryToolLocators.btn_explain_timing):
|
QueryToolLocators.btn_explain_timing):
|
||||||
self.page.find_by_css_selector(op).click()
|
self.page.find_by_css_selector(op).click()
|
||||||
|
|
||||||
explain_op.click()
|
|
||||||
|
|
||||||
self.page.find_by_css_selector(
|
self.page.find_by_css_selector(
|
||||||
QueryToolLocators.btn_explain_analyze).click()
|
QueryToolLocators.btn_explain_analyze).click()
|
||||||
|
|
||||||
@ -685,9 +681,10 @@ SELECT 1, pg_sleep(300)"""
|
|||||||
|
|
||||||
self.page.fill_codemirror_area_with(
|
self.page.fill_codemirror_area_with(
|
||||||
"SELECT count(*) FROM pg_catalog.pg_class;")
|
"SELECT count(*) FROM pg_catalog.pg_class;")
|
||||||
explain_op = self.page.find_by_css_selector(
|
|
||||||
QueryToolLocators.btn_explain_options_dropdown)
|
self.page.retry_click(
|
||||||
explain_op.click()
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_options_dropdown),
|
||||||
|
(By.CSS_SELECTOR, QueryToolLocators.btn_explain_verbose))
|
||||||
|
|
||||||
# disable Explain options and only enable COST option
|
# disable Explain options and only enable COST option
|
||||||
for op in (QueryToolLocators.btn_explain_verbose,
|
for op in (QueryToolLocators.btn_explain_verbose,
|
||||||
@ -702,9 +699,7 @@ SELECT 1, pg_sleep(300)"""
|
|||||||
QueryToolLocators.btn_explain_costs)
|
QueryToolLocators.btn_explain_costs)
|
||||||
cost_btn.click()
|
cost_btn.click()
|
||||||
|
|
||||||
# close explain options
|
# close explain options not required
|
||||||
explain_op.click()
|
|
||||||
|
|
||||||
self.page.find_by_css_selector(
|
self.page.find_by_css_selector(
|
||||||
QueryToolLocators.btn_explain_analyze).click()
|
QueryToolLocators.btn_explain_analyze).click()
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class PgadminPage:
|
|||||||
|
|
||||||
# pgAdmin related methods
|
# pgAdmin related methods
|
||||||
def login_to_app(self, user_detail):
|
def login_to_app(self, user_detail):
|
||||||
|
self.driver.switch_to.default_content()
|
||||||
if not (self.check_if_element_exist_by_xpath(
|
if not (self.check_if_element_exist_by_xpath(
|
||||||
'//a[@id="navbar-user"]', 1)):
|
'//a[@id="navbar-user"]', 1)):
|
||||||
user_edt_box_el = self.driver.find_element_by_name('email')
|
user_edt_box_el = self.driver.find_element_by_name('email')
|
||||||
@ -253,12 +254,15 @@ class PgadminPage:
|
|||||||
css_selector_of_option)
|
css_selector_of_option)
|
||||||
if menu_option.get_attribute('data-checked') == 'false':
|
if menu_option.get_attribute('data-checked') == 'false':
|
||||||
while retry > 0:
|
while retry > 0:
|
||||||
|
try:
|
||||||
menu_option.click()
|
menu_option.click()
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
if menu_option.get_attribute('data-checked') == 'true':
|
if menu_option.get_attribute('data-checked') == 'true':
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
retry -= 1
|
retry -= 1
|
||||||
|
except Exception:
|
||||||
|
retry -= 1
|
||||||
|
|
||||||
if option == 'auto_commit':
|
if option == 'auto_commit':
|
||||||
update_execute_option_setting(
|
update_execute_option_setting(
|
||||||
@ -618,6 +622,7 @@ class PgadminPage:
|
|||||||
database_node = \
|
database_node = \
|
||||||
self.check_if_element_exists_with_scroll(database_node_xpath)
|
self.check_if_element_exists_with_scroll(database_node_xpath)
|
||||||
if database_node:
|
if database_node:
|
||||||
|
database_node.click()
|
||||||
self.driver.execute_script(
|
self.driver.execute_script(
|
||||||
self.js_executor_scrollintoview_arg, database_node)
|
self.js_executor_scrollintoview_arg, database_node)
|
||||||
if self.check_if_element_exist_by_xpath(
|
if self.check_if_element_exist_by_xpath(
|
||||||
|
@ -1384,7 +1384,7 @@ def launch_url_in_browser(driver_instance, url, title='pgAdmin 4', timeout=50):
|
|||||||
raise WebDriverException(exception_msg)
|
raise WebDriverException(exception_msg)
|
||||||
|
|
||||||
|
|
||||||
def get_remote_webdriver(hub_url, browser, browser_ver, test_name):
|
def get_remote_webdriver(hub_url, browser, browser_ver, test_name, url_client):
|
||||||
"""
|
"""
|
||||||
This functions returns remote web-driver instance created in selenoid
|
This functions returns remote web-driver instance created in selenoid
|
||||||
machine.
|
machine.
|
||||||
@ -1421,6 +1421,8 @@ def get_remote_webdriver(hub_url, browser, browser_ver, test_name):
|
|||||||
elif browser == 'chrome':
|
elif browser == 'chrome':
|
||||||
options = Options()
|
options = Options()
|
||||||
options.add_argument("--window-size=1280,1024")
|
options.add_argument("--window-size=1280,1024")
|
||||||
|
options.add_argument(
|
||||||
|
'--unsafely-treat-insecure-origin-as-secure=' + url_client)
|
||||||
desired_capabilities["browserName"] = "chrome"
|
desired_capabilities["browserName"] = "chrome"
|
||||||
driver_local = webdriver.Remote(
|
driver_local = webdriver.Remote(
|
||||||
command_executor=hub_url,
|
command_executor=hub_url,
|
||||||
|
@ -601,7 +601,8 @@ def run_parallel_tests(url_client, servers_details, parallel_tests_lists,
|
|||||||
test_utils.get_remote_webdriver(hub_url,
|
test_utils.get_remote_webdriver(hub_url,
|
||||||
name_of_browser,
|
name_of_browser,
|
||||||
version_of_browser,
|
version_of_browser,
|
||||||
ser['name'])
|
ser['name'],
|
||||||
|
url_client)
|
||||||
# Launch client url in browser
|
# Launch client url in browser
|
||||||
test_utils.launch_url_in_browser(
|
test_utils.launch_url_in_browser(
|
||||||
driver_object, url_client, timeout=60)
|
driver_object, url_client, timeout=60)
|
||||||
@ -659,7 +660,8 @@ def run_sequential_tests(url_client, servers_details, sequential_tests_lists,
|
|||||||
driver_object = test_utils.get_remote_webdriver(hub_url,
|
driver_object = test_utils.get_remote_webdriver(hub_url,
|
||||||
name_of_browser,
|
name_of_browser,
|
||||||
version_of_browser,
|
version_of_browser,
|
||||||
"Sequential_Tests")
|
"Sequential_Tests",
|
||||||
|
url_client)
|
||||||
|
|
||||||
# Launch client url in browser
|
# Launch client url in browser
|
||||||
test_utils.launch_url_in_browser(driver_object, url_client)
|
test_utils.launch_url_in_browser(driver_object, url_client)
|
||||||
|
Loading…
Reference in New Issue
Block a user