diff --git a/web/regression/README b/web/regression/README index 88edbd8..6d77101 100644 --- a/web/regression/README +++ b/web/regression/README @@ -46,7 +46,7 @@ General Information - 'pgAdmin4/web/pgadmin/browser/server_groups/tests/' shows an example of tree traversal of the pgAdmin modules and how the test folder is required for each individual module. - + - 'pgadmin/browser/server_groups/servers/tests/' directory will have separate file for each test-case: @@ -127,6 +127,14 @@ Python Tests: https://sites.google.com/a/chromium.org/chromedriver/downloads or a package manager and make sure it is in the PATH +- For feature tests to run on Firefox, geckodriver need to be installed; + - Get geckodriver from https://github.com/mozilla/geckodriver/releases. + - Extract the binary and run chmod +x geckodriver. + - Copy geckodriver into /usr/local/bin or make sure path of the + geckodriver must be specified in the PATH. + - Set the "feature_test_default_browser" parameter in test_config file. + Supported browsers are "Chrome" and "Firefox". + - The test framework is modular and pluggable and dynamically locates tests for modules which are discovered at runtime. All test cases are found and registered automatically by its module name in diff --git a/web/regression/feature_utils/app_starter.py b/web/regression/feature_utils/app_starter.py index 77b0400..f845634 100644 --- a/web/regression/feature_utils/app_starter.py +++ b/web/regression/feature_utils/app_starter.py @@ -12,6 +12,7 @@ import signal import random import time +from selenium.common.exceptions import WebDriverException class AppStarter: @@ -42,10 +43,19 @@ class AppStarter: ) self.driver.set_window_size(1280, 1024) - self.driver.get( - "http://" + self.app_config.DEFAULT_SERVER + ":" + - random_server_port - ) + + def launch_browser(): + try: + self.driver.get( + "http://" + self.app_config.DEFAULT_SERVER + ":" + + random_server_port + ) + + except WebDriverException as e: + time.sleep(5) + launch_browser() + + launch_browser() def stop_app(self): """ This function stop the started app by killing process """ diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 1de9823..a75e903 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -180,7 +180,11 @@ def get_test_modules(arguments): exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs: - driver = webdriver.Chrome() + if "feature_test_default_browser" in test_setup.config_data and \ + test_setup.config_data['feature_test_default_browser'] == 'Firefox': + driver = webdriver.Firefox() + else: + driver = webdriver.Chrome() app_starter = AppStarter(driver, config) app_starter.start_app() diff --git a/web/regression/test_config.json.in b/web/regression/test_config.json.in index 47f8499..7eadebc 100644 --- a/web/regression/test_config.json.in +++ b/web/regression/test_config.json.in @@ -28,5 +28,6 @@ { "comment": "This is test update comment" } - ] + ], + "feature_test_default_browser": "Chrome" }