Esempio n. 1
0
 def beforeTest(self, test):
     test.test.browser = self.options.browser
     test.test.cap_file = self.options.cap_file
     test.test.headless = self.options.headless
     test.test.headed = self.options.headed
     test.test.start_page = self.options.start_page
     test.test.servername = self.options.servername
     test.test.port = self.options.port
     test.test.user_data_dir = self.options.user_data_dir
     test.test.extension_zip = self.options.extension_zip
     test.test.extension_dir = self.options.extension_dir
     test.test.proxy_string = self.options.proxy_string
     test.test.user_agent = self.options.user_agent
     test.test.mobile_emulator = self.options.mobile_emulator
     test.test.device_metrics = self.options.device_metrics
     test.test.time_limit = self.options.time_limit
     test.test.slow_mode = self.options.slow_mode
     test.test.demo_mode = self.options.demo_mode
     test.test.demo_sleep = self.options.demo_sleep
     test.test.highlights = self.options.highlights
     test.test.message_duration = self.options.message_duration
     test.test.js_checking_on = self.options.js_checking_on
     test.test.ad_block_on = self.options.ad_block_on
     test.test.verify_delay = self.options.verify_delay  # MasterQA
     test.test.disable_csp = self.options.disable_csp
     test.test.enable_sync = self.options.enable_sync
     test.test.incognito = self.options.incognito
     test.test.maximize_option = self.options.maximize_option
     test.test.save_screenshot_after_test = self.options.save_screenshot
     test.test.visual_baseline = self.options.visual_baseline
     test.test.timeout_multiplier = self.options.timeout_multiplier
     test.test.use_grid = False
     test.test._reuse_session = False
     if test.test.servername != "localhost":
         # Use Selenium Grid (Use --server=127.0.0.1 for localhost Grid)
         test.test.use_grid = True
     if "linux" in sys.platform and (not self.options.headed
                                     and not self.options.headless):
         print("(Running with --headless on Linux. "
               "Use --headed or --gui to override.)")
         self.options.headless = True
         test.test.headless = True
     if not self.options.headless:
         self.options.headed = True
         test.test.headed = True
     if self.options.headless:
         try:
             # from pyvirtualdisplay import Display  # Skip for own lib
             from seleniumbase.virtual_display.display import Display
             self.display = Display(visible=0, size=(1440, 1880))
             self.display.start()
             self.headless_active = True
         except Exception:
             # pyvirtualdisplay might not be necessary anymore because
             # Chrome and Firefox now have built-in headless displays
             pass
     # The driver will be received later
     self.driver = None
     test.test.driver = self.driver
Esempio n. 2
0
    def beforeTest(self, test):
        test.test.browser = self.options.browser
        test.test.cap_file = self.options.cap_file
        test.test.cap_string = self.options.cap_string
        test.test.headless = self.options.headless
        test.test.headed = self.options.headed
        test.test.locale_code = self.options.locale_code
        test.test.interval = self.options.interval
        test.test.start_page = self.options.start_page
        test.test.protocol = self.options.protocol
        test.test.servername = self.options.servername
        test.test.port = self.options.port
        test.test.user_data_dir = self.options.user_data_dir
        test.test.extension_zip = self.options.extension_zip
        test.test.extension_dir = self.options.extension_dir
        test.test.chromium_arg = self.options.chromium_arg
        test.test.firefox_arg = self.options.firefox_arg
        test.test.firefox_pref = self.options.firefox_pref
        test.test.proxy_string = self.options.proxy_string
        test.test.user_agent = self.options.user_agent
        test.test.mobile_emulator = self.options.mobile_emulator
        test.test.device_metrics = self.options.device_metrics
        test.test.time_limit = self.options.time_limit
        test.test.slow_mode = self.options.slow_mode
        test.test.demo_mode = self.options.demo_mode
        test.test.demo_sleep = self.options.demo_sleep
        test.test.highlights = self.options.highlights
        test.test.message_duration = self.options.message_duration
        test.test.js_checking_on = self.options.js_checking_on
        test.test.ad_block_on = self.options.ad_block_on
        test.test.block_images = self.options.block_images
        test.test.verify_delay = self.options.verify_delay  # MasterQA
        test.test.disable_csp = self.options.disable_csp
        test.test.disable_ws = self.options.disable_ws
        test.test.enable_ws = self.options.enable_ws
        if not self.options.disable_ws:
            test.test.enable_ws = True
        test.test.enable_sync = self.options.enable_sync
        test.test.use_auto_ext = self.options.use_auto_ext
        test.test.no_sandbox = self.options.no_sandbox
        test.test.disable_gpu = self.options.disable_gpu
        test.test.remote_debug = self.options.remote_debug
        test.test.swiftshader = self.options.swiftshader
        test.test.incognito = self.options.incognito
        test.test.guest_mode = self.options.guest_mode
        test.test.devtools = self.options.devtools
        test.test.maximize_option = self.options.maximize_option
        test.test.save_screenshot_after_test = self.options.save_screenshot
        test.test.visual_baseline = self.options.visual_baseline
        test.test.timeout_multiplier = self.options.timeout_multiplier
        test.test.use_grid = False
        test.test.dashboard = False
        test.test._multithreaded = False
        test.test._reuse_session = False
        if test.test.servername != "localhost":
            # Use Selenium Grid (Use --server="127.0.0.1" for localhost Grid)
            test.test.use_grid = True
        if "linux" in sys.platform and (not self.options.headed
                                        and not self.options.headless):
            print("(Running with --headless on Linux. "
                  "Use --headed or --gui to override.)")
            self.options.headless = True
            test.test.headless = True
        if not self.options.headless:
            self.options.headed = True
            test.test.headed = True
        if self.options.headless:
            try:
                # from pyvirtualdisplay import Display  # Skip for own lib
                from seleniumbase.virtual_display.display import Display

                self.display = Display(visible=0, size=(1440, 1880))
                self.display.start()
                self.headless_active = True
            except Exception:
                # pyvirtualdisplay might not be necessary anymore because
                # Chrome and Firefox now have built-in headless displays
                pass
        sb_config._is_timeout_changed = False
        sb_config._SMALL_TIMEOUT = settings.SMALL_TIMEOUT
        sb_config._LARGE_TIMEOUT = settings.LARGE_TIMEOUT
        # The driver will be received later
        self.driver = None
        test.test.driver = self.driver