2018-10-08 11:09:30 +01:00
|
|
|
##########################################################################
|
|
|
|
|
#
|
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
#
|
2024-01-01 14:13:48 +05:30
|
|
|
# Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2018-10-08 11:09:30 +01:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
|
#
|
|
|
|
|
##########################################################################
|
2022-08-11 10:49:45 +05:30
|
|
|
import time
|
2019-11-11 10:49:00 +05:30
|
|
|
from regression.feature_utils.locators import NavMenuLocators
|
2022-07-08 18:25:00 +05:30
|
|
|
from selenium.webdriver.common.by import By
|
2022-08-11 10:49:45 +05:30
|
|
|
from selenium.webdriver.support import expected_conditions as EC
|
2018-10-08 11:09:30 +01:00
|
|
|
|
|
|
|
|
|
2022-08-11 10:49:45 +05:30
|
|
|
def close_bgprocess_start_popup(tester):
|
2018-10-08 11:09:30 +01:00
|
|
|
"""
|
2019-05-23 09:31:52 +01:00
|
|
|
Allows us to close the background process popup window
|
2018-10-08 11:09:30 +01:00
|
|
|
"""
|
2022-08-11 10:49:45 +05:30
|
|
|
tester.driver.find_element(
|
|
|
|
|
By.CSS_SELECTOR,
|
|
|
|
|
NavMenuLocators.process_start_close_selector).click()
|
2018-10-08 11:09:30 +01:00
|
|
|
|
2019-04-05 12:25:03 +05:30
|
|
|
|
2022-08-11 10:49:45 +05:30
|
|
|
def wait_for_process_start(tester):
|
|
|
|
|
tester.wait.until(EC.visibility_of_element_located(
|
|
|
|
|
(By.CSS_SELECTOR,
|
|
|
|
|
NavMenuLocators.process_start_close_selector)))
|
|
|
|
|
close_bgprocess_start_popup(tester)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def wait_for_process_end(self):
|
|
|
|
|
"""This will wait for process to complete dialogue status"""
|
|
|
|
|
attempts = 120
|
|
|
|
|
status = False
|
|
|
|
|
while attempts > 0:
|
|
|
|
|
try:
|
|
|
|
|
button = self.page.find_by_css_selector(
|
|
|
|
|
NavMenuLocators.process_end_close_selector)
|
|
|
|
|
status = True
|
|
|
|
|
button.click()
|
|
|
|
|
break
|
|
|
|
|
except Exception:
|
|
|
|
|
attempts -= 1
|
|
|
|
|
time.sleep(.5)
|
|
|
|
|
return status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def open_process_details(tester):
|
|
|
|
|
status = wait_for_process_end(tester)
|
|
|
|
|
if not status:
|
|
|
|
|
raise RuntimeError("Process not completed")
|
|
|
|
|
|
|
|
|
|
tester.page.click_tab("Processes")
|
|
|
|
|
time.sleep(3)
|
|
|
|
|
tester.page.find_by_css_selector(
|
|
|
|
|
"div[data-test='processes'] "
|
|
|
|
|
"div[data-test='row-container']:nth-child(1) "
|
|
|
|
|
"div[role='row'] div[role='cell']:nth-child(3) button").click()
|
|
|
|
|
|
|
|
|
|
tester.page.wait_for_element_to_disappear(
|
|
|
|
|
lambda driver: driver.find_element(
|
|
|
|
|
By.CSS_SELECTOR, "span[data-test='loading-logs']"))
|
2019-11-11 10:49:00 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
def close_process_watcher(tester):
|
2023-10-23 17:43:17 +05:30
|
|
|
tester.page.click_modal('Close', docker=True)
|