pgadmin4/web/regression/python_test_utils/test_gui_helper.py
Murtuza Zabuawala 0f1651686b Code refactoring:
- Move the duplicate code for closing the background process dialog into 'test_gui_helper.py',
- Simplify the logic by removing the duplicate steps to insert/update binary paths for each server type from 'test_utils.py'.
2018-10-08 11:09:30 +01:00

39 lines
1.3 KiB
Python

##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
def close_bgprocess_popup(tester):
"""
Allow us to close the background process popup window
"""
tester._screenshot()
# In cases where backup div is not closed (sometime due to some error)
try:
if tester.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible > div > "
"div > div > i"):
tester.driver.find_element_by_css_selector(
".ajs-message.ajs-bg-bgprocess.ajs-visible >div >div "
">div>i").click()
except Exception:
pass
# In cases where restore div is not closed (sometime due to some error)
try:
if tester.driver.find_element_by_xpath(
"//div[contains(text(), 'Process Watcher - "
"Restoring backup')]"):
tester.driver.find_element_by_xpath(
"//div[div[div[div[contains(text(), 'Process Watcher "
"- Restoring backup')]]]]"
"/following-sibling::div/div/div").click()
except Exception:
pass