mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Feature test stabilisation.
This commit is contained in:
committed by
Dave Page
parent
ee37be56f9
commit
dcd163ac02
@@ -10,14 +10,15 @@
|
||||
|
||||
def close_bgprocess_popup(tester):
|
||||
"""
|
||||
Allow us to close the background process popup window
|
||||
Allows us to close the background process popup window
|
||||
"""
|
||||
tester._screenshot()
|
||||
|
||||
screen_shot_taken = False
|
||||
# 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"):
|
||||
tester._screenshot()
|
||||
screen_shot_taken = True
|
||||
tester.driver.find_element_by_css_selector(
|
||||
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
||||
except Exception:
|
||||
@@ -28,6 +29,8 @@ def close_bgprocess_popup(tester):
|
||||
if tester.driver.find_element_by_xpath(
|
||||
"//div[@class='card-header bg-primary d-flex']/div"
|
||||
"[contains(text(), 'Restoring backup')]"):
|
||||
tester._screenshot()
|
||||
screen_shot_taken = True
|
||||
tester.driver.find_element_by_css_selector(
|
||||
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
||||
except Exception:
|
||||
@@ -39,7 +42,12 @@ def close_bgprocess_popup(tester):
|
||||
if tester.driver.find_element_by_xpath(
|
||||
"//div[@class='card-header bg-primary d-flex']/div"
|
||||
"[contains(text(), 'Maintenance')]"):
|
||||
tester._screenshot()
|
||||
screen_shot_taken = True
|
||||
tester.driver.find_element_by_css_selector(
|
||||
".btn.btn-sm-sq.btn-primary.pg-bg-close > i").click()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not screen_shot_taken:
|
||||
tester._screenshot()
|
||||
|
||||
@@ -319,6 +319,26 @@ def drop_debug_function(server, db_name, function_name="test_func"):
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
|
||||
|
||||
def does_function_exist(server, db_name, fun_name):
|
||||
query = "select exists(select * " \
|
||||
"from pg_proc where proname = '%s');" % fun_name
|
||||
|
||||
connection = get_db_connection(
|
||||
db_name,
|
||||
server['username'],
|
||||
server['db_password'],
|
||||
server['host'],
|
||||
server['port'],
|
||||
server['sslmode']
|
||||
)
|
||||
|
||||
cursor = connection.cursor()
|
||||
|
||||
cursor.execute(query)
|
||||
result = cursor.fetchall()
|
||||
return str(result[0][0])
|
||||
|
||||
|
||||
def create_role(server, db_name, role_name="test_role"):
|
||||
try:
|
||||
connection = get_db_connection(
|
||||
@@ -1006,3 +1026,22 @@ def check_binary_path_or_skip_test(cls, utility_name):
|
||||
retVal = is_utility_exists(binary_path)
|
||||
if retVal is not None:
|
||||
cls.skipTest(retVal)
|
||||
|
||||
|
||||
def get_watcher_dialogue_status(self):
|
||||
"""This will get watcher dialogue status"""
|
||||
import time
|
||||
attempts = 120
|
||||
|
||||
while attempts > 0:
|
||||
status = self.page.find_by_css_selector(
|
||||
".pg-bg-status-text").text
|
||||
|
||||
if 'Failed' in status:
|
||||
break
|
||||
if status == 'Started' or status == 'Running...':
|
||||
attempts -= 1
|
||||
time.sleep(.5)
|
||||
else:
|
||||
break
|
||||
return status
|
||||
|
||||
Reference in New Issue
Block a user