2018-10-08 05:09:30 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2019-01-02 04:24:12 -06:00
|
|
|
# Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
2018-10-08 05:09:30 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
2019-11-10 23:19:00 -06:00
|
|
|
from regression.feature_utils.locators import NavMenuLocators
|
2018-10-08 05:09:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
def close_bgprocess_popup(tester):
|
|
|
|
"""
|
2019-05-23 03:31:52 -05:00
|
|
|
Allows us to close the background process popup window
|
2018-10-08 05:09:30 -05:00
|
|
|
"""
|
|
|
|
# In cases where backup div is not closed (sometime due to some error)
|
|
|
|
try:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.page.wait_for_element_to_disappear(
|
|
|
|
lambda x: tester.driver.find_element_by_xpath(
|
|
|
|
".ajs-message.ajs-bg-bgprocess.ajs-visible"))
|
2018-10-08 05:09:30 -05:00
|
|
|
except Exception:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.driver.find_element_by_css_selector(
|
|
|
|
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
2018-10-08 05:09:30 -05:00
|
|
|
|
|
|
|
# In cases where restore div is not closed (sometime due to some error)
|
|
|
|
try:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.page.wait_for_element_to_disappear(
|
|
|
|
lambda x: tester.driver.find_element_by_xpath(
|
2019-04-05 01:55:03 -05:00
|
|
|
"//div[@class='card-header bg-primary d-flex']/div"
|
2019-08-22 04:20:51 -05:00
|
|
|
"[contains(text(), 'Restoring backup')]"))
|
2019-04-05 01:55:03 -05:00
|
|
|
except Exception:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.driver.find_element_by_css_selector(
|
|
|
|
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
2019-04-05 01:55:03 -05:00
|
|
|
|
|
|
|
# In cases where maintenance window is not closed (sometime due to some
|
|
|
|
# error)
|
|
|
|
try:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.page.wait_for_element_to_disappear(
|
|
|
|
lambda x: tester.driver.find_element_by_xpath(
|
2019-04-05 01:55:03 -05:00
|
|
|
"//div[@class='card-header bg-primary d-flex']/div"
|
2019-08-22 04:20:51 -05:00
|
|
|
"[contains(text(), 'Maintenance')]"))
|
2018-10-08 05:09:30 -05:00
|
|
|
except Exception:
|
2019-08-22 04:20:51 -05:00
|
|
|
tester.driver.find_element_by_css_selector(
|
|
|
|
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
2019-11-10 23:19:00 -06:00
|
|
|
|
|
|
|
|
|
|
|
def close_process_watcher(tester):
|
2019-11-12 23:49:21 -06:00
|
|
|
attempt = 10
|
2019-11-10 23:19:00 -06:00
|
|
|
while attempt > 0:
|
|
|
|
close_btn = tester.page.find_by_xpath(
|
|
|
|
NavMenuLocators.process_watcher_close_button_xpath)
|
|
|
|
close_btn.click()
|
|
|
|
if not tester.page.check_if_element_exist_by_xpath(
|
|
|
|
NavMenuLocators.process_watcher_close_button_xpath, 1):
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
attempt -= 1
|