mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed feature tests failing due to selenium upgrade to 4.10.0.
This commit is contained in:
parent
b8377be1b5
commit
eef295f9d8
@ -26,7 +26,7 @@ from selenium.common.exceptions import WebDriverException
|
|||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
import json
|
import json
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
||||||
from selenium.webdriver.support import expected_conditions as ec
|
from selenium.webdriver.support import expected_conditions as ec
|
||||||
import selenium.common.exceptions
|
import selenium.common.exceptions
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ import regression
|
|||||||
from regression import test_setup
|
from regression import test_setup
|
||||||
|
|
||||||
from pgadmin.utils.preferences import Preferences
|
from pgadmin.utils.preferences import Preferences
|
||||||
from pgadmin.utils.constants import BINARY_PATHS, PSYCOPG3
|
from pgadmin.utils.constants import BINARY_PATHS
|
||||||
from pgadmin.utils import set_binary_path
|
from pgadmin.utils import set_binary_path
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
@ -1410,38 +1410,34 @@ def get_remote_webdriver(hub_url, browser, browser_ver, test_name, url_client):
|
|||||||
test_name = time.strftime("%m_%d_%y_%H_%M_%S_", time.localtime()) + \
|
test_name = time.strftime("%m_%d_%y_%H_%M_%S_", time.localtime()) + \
|
||||||
test_name.replace(' ', '_') + '_' + browser + browser_ver
|
test_name.replace(' ', '_') + '_' + browser + browser_ver
|
||||||
driver_local = None
|
driver_local = None
|
||||||
desired_capabilities = {
|
selenoid_options = {
|
||||||
"browserVersion": browser_ver,
|
"enableVNC": True,
|
||||||
"selenoid:options": {
|
"enableVideo": True,
|
||||||
"enableVNC": True,
|
"enableLog": True,
|
||||||
"enableVideo": True,
|
"videoName": test_name + ".mp4",
|
||||||
"enableLog": True,
|
"logName": test_name + ".log",
|
||||||
"videoName": test_name + ".mp4",
|
"name": test_name,
|
||||||
"logName": test_name + ".log",
|
"timeZone": "Asia/Kolkata",
|
||||||
"name": test_name,
|
"sessionTimeout": "180s"
|
||||||
"timeZone": "Asia/Kolkata",
|
|
||||||
"sessionTimeout": "180s"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if browser == 'firefox':
|
if browser == 'firefox':
|
||||||
|
options = FirefoxOptions()
|
||||||
|
options.browser_version = browser_ver
|
||||||
profile = webdriver.FirefoxProfile()
|
profile = webdriver.FirefoxProfile()
|
||||||
profile.set_preference("dom.disable_beforeunload", True)
|
profile.set_preference("dom.disable_beforeunload", True)
|
||||||
desired_capabilities["browserName"] = "firefox"
|
options.profile = profile
|
||||||
desired_capabilities["requireWindowFocus"] = True
|
|
||||||
desired_capabilities["enablePersistentHover"] = False
|
|
||||||
driver_local = webdriver.Remote(
|
driver_local = webdriver.Remote(
|
||||||
command_executor=hub_url,
|
command_executor=hub_url, options=options)
|
||||||
desired_capabilities=desired_capabilities, browser_profile=profile)
|
|
||||||
elif browser == 'chrome':
|
elif browser == 'chrome':
|
||||||
options = Options()
|
options = webdriver.ChromeOptions()
|
||||||
options.add_argument("--window-size=1280,1024")
|
options.add_argument("--window-size=1280,1024")
|
||||||
options.add_argument(
|
options.add_argument(
|
||||||
'--unsafely-treat-insecure-origin-as-secure=' + url_client)
|
'--unsafely-treat-insecure-origin-as-secure=' + url_client)
|
||||||
desired_capabilities["browserName"] = "chrome"
|
options.browser_version = browser_ver
|
||||||
|
options.set_capability("selenoid:options", selenoid_options)
|
||||||
driver_local = webdriver.Remote(
|
driver_local = webdriver.Remote(
|
||||||
command_executor=hub_url,
|
command_executor=hub_url, options=options)
|
||||||
desired_capabilities=desired_capabilities, options=options)
|
|
||||||
else:
|
else:
|
||||||
print("Specified browser does not exist.")
|
print("Specified browser does not exist.")
|
||||||
|
|
||||||
|
@ -25,5 +25,5 @@ python-mimeparse==1.6.0
|
|||||||
testscenarios==0.5.0
|
testscenarios==0.5.0
|
||||||
testtools==2.6.0
|
testtools==2.6.0
|
||||||
traceback2==1.4.0
|
traceback2==1.4.0
|
||||||
selenium==4.9.1
|
selenium==4.10.0
|
||||||
coverage==7.2.7
|
coverage==7.2.7
|
||||||
|
@ -23,6 +23,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||||
@ -283,13 +284,14 @@ def setup_webdriver_specification(arguments):
|
|||||||
'default_browser'].lower()
|
'default_browser'].lower()
|
||||||
|
|
||||||
if default_browser == 'firefox':
|
if default_browser == 'firefox':
|
||||||
|
options = FirefoxOptions()
|
||||||
cap = DesiredCapabilities.FIREFOX
|
cap = DesiredCapabilities.FIREFOX
|
||||||
cap['requireWindowFocus'] = True
|
cap['requireWindowFocus'] = True
|
||||||
cap['enablePersistentHover'] = False
|
cap['enablePersistentHover'] = False
|
||||||
profile = webdriver.FirefoxProfile()
|
profile = webdriver.FirefoxProfile()
|
||||||
profile.set_preference("dom.disable_beforeunload", True)
|
profile.set_preference("dom.disable_beforeunload", True)
|
||||||
driver_local = webdriver.Firefox(capabilities=cap,
|
options.profile = profile
|
||||||
firefox_profile=profile)
|
driver_local = webdriver.Firefox(options=options)
|
||||||
driver_local.implicitly_wait(1)
|
driver_local.implicitly_wait(1)
|
||||||
else:
|
else:
|
||||||
options = Options()
|
options = Options()
|
||||||
|
Loading…
Reference in New Issue
Block a user