def get_test_modules(arguments): """ This function loads the all modules in the tests directory into testing environment. :param arguments: this is command line arguments for module name to which test suite will run :type arguments: dict :return module list: test module list :rtype: list """ from pgadmin.utils.route import TestsGeneratorRegistry exclude_pkgs = [] global driver, app_starter, handle_cleanup if not config.SERVER_MODE: # following test cases applicable only for server mode exclude_pkgs.extend([ "browser.tests.test_change_password", "browser.tests.test_gravatar_image_display", "browser.tests.test_login", "browser.tests.test_logout", "browser.tests.test_reset_password", "browser.tests.test_ldap_login", "browser.tests.test_ldap_with_mocking", ]) if arguments['exclude'] is not None: exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs and \ (arguments['pkg'] is None or arguments['pkg'] == "all" or arguments['pkg'] == "feature_tests"): if arguments['pkg'] == "feature_tests": exclude_pkgs.extend(['resql']) if not test_utils.is_parallel_ui_tests(args): driver = setup_webdriver_specification(arguments) app_starter = AppStarter(driver, config) app_starter.start_app() handle_cleanup = test_utils.get_cleanup_handler(test_client, app_starter) # Register cleanup function to cleanup on exit atexit.register(handle_cleanup) # Load Test modules module_list = load_modules(arguments, exclude_pkgs) return module_list
def get_test_modules(arguments): """ This function loads the all modules in the tests directory into testing environment. :param arguments: this is command line arguments for module name to which test suite will run :type arguments: dict :return module list: test module list :rtype: list """ from pgadmin.utils.route import TestsGeneratorRegistry exclude_pkgs = [] global driver, app_starter, handle_cleanup if not config.SERVER_MODE: exclude_pkgs.append("browser.tests") if arguments['exclude'] is not None: exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs: options = Options() if test_setup.config_data: if 'headless_chrome' in test_setup.config_data: if test_setup.config_data['headless_chrome']: options.add_argument("--headless") options.add_argument("--window-size=1280x1024") driver = webdriver.Chrome(chrome_options=options) app_starter = AppStarter(driver, config) app_starter.start_app() handle_cleanup = test_utils.get_cleanup_handler(test_client, app_starter) # Register cleanup function to cleanup on exit atexit.register(handle_cleanup) # Load the test modules which are in given package(i.e. in arguments.pkg) if arguments['pkg'] is None or arguments['pkg'] == "all": TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs) else: TestsGeneratorRegistry.load_generators('pgadmin.%s' % arguments['pkg'], exclude_pkgs) # Sort module list so that test suite executes the test cases sequentially module_list = TestsGeneratorRegistry.registry.items() module_list = sorted(module_list, key=lambda module_tuple: module_tuple[0]) return module_list
def get_test_modules(arguments): """ This function loads the all modules in the tests directory into testing environment. :param arguments: this is command line arguments for module name to which test suite will run :type arguments: dict :return module list: test module list :rtype: list """ from pgadmin.utils.route import TestsGeneratorRegistry exclude_pkgs = [] global driver, app_starter, handle_cleanup if not config.SERVER_MODE: # following test cases applicable only for server mode exclude_pkgs.extend([ "browser.tests.test_change_password", "browser.tests.test_gravatar_image_display", "browser.tests.test_login", "browser.tests.test_logout", "browser.tests.test_reset_password", ]) if arguments['exclude'] is not None: exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs and \ (arguments['pkg'] is None or arguments['pkg'] == "all" or arguments['pkg'] == "feature_tests"): from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.desired_capabilities import \ DesiredCapabilities default_browser = 'chrome' # Check default browser provided through command line. If provided # then use that browser as default browser else check for the setting # provided in test_config.json file. if ('default_browser' in arguments and arguments['default_browser'] is not None): default_browser = arguments['default_browser'].lower() elif (test_setup.config_data and "default_browser" in test_setup.config_data): default_browser = test_setup.config_data['default_browser'].lower() if default_browser == 'firefox': cap = DesiredCapabilities.FIREFOX cap['requireWindowFocus'] = True cap['enablePersistentHover'] = False profile = webdriver.FirefoxProfile() profile.set_preference("dom.disable_beforeunload", True) driver = webdriver.Firefox(capabilities=cap, firefox_profile=profile) driver.implicitly_wait(1) else: options = Options() if test_setup.config_data: if 'headless_chrome' in test_setup.config_data: if test_setup.config_data['headless_chrome']: options.add_argument("--headless") options.add_argument("--window-size=1280,1024") options.add_argument("--disable-infobars") options.add_experimental_option('w3c', False) driver = webdriver.Chrome(chrome_options=options) # maximize browser window driver.maximize_window() app_starter = AppStarter(driver, config) app_starter.start_app() handle_cleanup = test_utils.get_cleanup_handler(test_client, app_starter) # Register cleanup function to cleanup on exit atexit.register(handle_cleanup) # Load the test modules which are in given package(i.e. in arguments.pkg) if arguments['pkg'] is None or arguments['pkg'] == "all": TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs) elif arguments['pkg'] is not None and arguments['pkg'] == "resql": # Load the reverse engineering sql test module TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs, is_resql_only=True) else: for_modules = [] if arguments['modules'] is not None: for_modules = arguments['modules'].split(',') TestsGeneratorRegistry.load_generators('pgadmin.%s' % arguments['pkg'], exclude_pkgs, for_modules) # Sort module list so that test suite executes the test cases sequentially module_list = TestsGeneratorRegistry.registry.items() module_list = sorted(module_list, key=lambda module_tuple: module_tuple[0]) return module_list
browser_name, browser_version = \ test_utils.get_browser_details(browser_info, hub_url) # test lists can be executed in parallel & sequentially parallel_tests, sequential_tests = \ test_utils.get_parallel_sequential_module_list( test_module_list) # Print test summary test_utils.print_test_summary( test_module_list, parallel_tests, sequential_tests, browser_name, browser_version) # Create app form source code app_starter_local = AppStarter(None, config) client_url = app_starter_local.start_app() # Running Parallel tests if len(parallel_tests) > 0: parallel_sessions = \ int(selenoid_config['max_parallel_sessions']) run_parallel_tests( client_url, servers_info, parallel_tests, browser_name, browser_version, parallel_sessions) # Sequential Tests if len(sequential_tests) > 0: run_sequential_tests(
def get_test_modules(arguments): """ This function loads the all modules in the tests directory into testing environment. :param arguments: this is command line arguments for module name to which test suite will run :type arguments: dict :return module list: test module list :rtype: list """ from pgadmin.utils.route import TestsGeneratorRegistry exclude_pkgs = [] global driver, app_starter, handle_cleanup if not config.SERVER_MODE: exclude_pkgs.append("browser.tests") if arguments['exclude'] is not None: exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs: default_browser = 'chrome' # Check default browser provided through command line. If provided # then use that browser as default browser else check for the setting # provided in test_config.json file. if ( 'default_browser' in arguments and arguments['default_browser'] is not None ): default_browser = arguments['default_browser'].lower() elif ( test_setup.config_data and "default_browser" in test_setup.config_data ): default_browser = test_setup.config_data['default_browser'].lower() if default_browser == 'firefox': cap = DesiredCapabilities.FIREFOX cap['requireWindowFocus'] = True cap['enablePersistentHover'] = False profile = webdriver.FirefoxProfile() profile.set_preference("dom.disable_beforeunload", True) driver = webdriver.Firefox(capabilities=cap, firefox_profile=profile) driver.implicitly_wait(1) else: options = Options() if test_setup.config_data: if 'headless_chrome' in test_setup.config_data: if test_setup.config_data['headless_chrome']: options.add_argument("--headless") options.add_argument("--window-size=1280,1024") driver = webdriver.Chrome(chrome_options=options) app_starter = AppStarter(driver, config) app_starter.start_app() handle_cleanup = test_utils.get_cleanup_handler(test_client, app_starter) # Register cleanup function to cleanup on exit atexit.register(handle_cleanup) # Load the test modules which are in given package(i.e. in arguments.pkg) if arguments['pkg'] is None or arguments['pkg'] == "all": TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs) else: TestsGeneratorRegistry.load_generators('pgadmin.%s' % arguments['pkg'], exclude_pkgs) # Sort module list so that test suite executes the test cases sequentially module_list = TestsGeneratorRegistry.registry.items() module_list = sorted(module_list, key=lambda module_tuple: module_tuple[0]) return module_list
def get_test_modules(arguments): """ This function loads the all modules in the tests directory into testing environment. :param arguments: this is command line arguments for module name to which test suite will run :type arguments: dict :return module list: test module list :rtype: list """ from pgadmin.utils.route import TestsGeneratorRegistry exclude_pkgs = [] global driver, app_starter, handle_cleanup if not config.SERVER_MODE: exclude_pkgs.append("browser.tests") if arguments['exclude'] is not None: exclude_pkgs += arguments['exclude'].split(',') if 'feature_tests' not in exclude_pkgs: default_browser = 'chrome' # Check default browser provided through command line. If provided # then use that browser as default browser else check for the setting # provided in test_config.json file. if ('default_browser' in arguments and arguments['default_browser'] is not None): default_browser = arguments['default_browser'].lower() elif (test_setup.config_data and "default_browser" in test_setup.config_data): default_browser = test_setup.config_data['default_browser'].lower() if default_browser == 'firefox': cap = DesiredCapabilities.FIREFOX cap['requireWindowFocus'] = True cap['enablePersistentHover'] = False profile = webdriver.FirefoxProfile() profile.set_preference("dom.disable_beforeunload", True) driver = webdriver.Firefox(capabilities=cap, firefox_profile=profile) driver.implicitly_wait(1) else: options = Options() if test_setup.config_data: if 'headless_chrome' in test_setup.config_data: if test_setup.config_data['headless_chrome']: options.add_argument("--headless") options.add_argument("--window-size=1280x1024") driver = webdriver.Chrome(chrome_options=options) app_starter = AppStarter(driver, config) app_starter.start_app() handle_cleanup = test_utils.get_cleanup_handler(test_client, app_starter) # Register cleanup function to cleanup on exit atexit.register(handle_cleanup) # Load the test modules which are in given package(i.e. in arguments.pkg) if arguments['pkg'] is None or arguments['pkg'] == "all": TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs) else: TestsGeneratorRegistry.load_generators('pgadmin.%s' % arguments['pkg'], exclude_pkgs) # Sort module list so that test suite executes the test cases sequentially module_list = TestsGeneratorRegistry.registry.items() module_list = sorted(module_list, key=lambda module_tuple: module_tuple[0]) return module_list