예제 #1
0
    def test_capabilities_for_w3c(self):
        options = SauceOptions()

        options.browser_name = 'firefox'
        options.browser_version = '7'
        options.platform_name = 'macOS 10.14'
        options.accept_insecure_certs = True
        options.page_load_strategy = 'eager'
        options.set_window_rect = True
        options.unhandled_prompt_behavior = 'accept'
        options.strict_file_interactability = True
        options.timeouts = {'implicit': 1,
                            'pageLoad': 59,
                            'script': 29}
        options.build = "Build Name"

        expected_capabilities = {'browserName': 'firefox',
                                 'browserVersion': '7',
                                 'platformName': 'macOS 10.14',
                                 'acceptInsecureCerts': True,
                                 'pageLoadStrategy': 'eager',
                                 'setWindowRect': True,
                                 'unhandledPromptBehavior': 'accept',
                                 'strictFileInteractability': True,
                                 'timeouts': {'implicit': 1,
                                              'pageLoad': 59,
                                              'script': 29},
                                 'sauce:options': {'build': 'Build Name'}}

        assert options.to_capabilities() == expected_capabilities
예제 #2
0
    def test_sauce_options(self):
        prerun = {'executable': 'http://url.to/your/executable.exe',
                  'args': ['--silent', '-a', '-q'],
                  'background': False,
                  'timeout': 120}
        custom_data = {'foo': 'foo',
                       'bar': 'bar'}
        tags = ['foo', 'bar']

        options = SauceOptions()

        options.avoid_proxy = True
        options.build = 'Sample Build Name'
        options.capture_performance = True
        options.chromedriver_version = '71'
        options.command_timeout = 2
        options.custom_data = custom_data
        options.extended_debugging = True
        options.idle_timeout = 3
        options.iedriver_version = '3.141.0'
        options.max_duration = 300
        options.name = 'Sample Test Name'
        options.parent_tunnel = 'Mommy'
        options.prerun = prerun
        options.priority = 0
        options.public = 'team'
        options.record_logs = False
        options.record_screenshots = False
        options.record_video = False
        options.screen_resolution = '10x10'
        options.selenium_version = '3.141.59'
        options.tags = tags
        options.time_zone = 'San Francisco'
        options.tunnel_identifier = 'tunnelname'
        options.video_upload_on_pass = False

        assert options.avoid_proxy is True
        assert options.build == 'Sample Build Name'
        assert options.capture_performance is True
        assert options.chromedriver_version == '71'
        assert options.command_timeout == 2
        assert options.custom_data == custom_data
        assert options.extended_debugging is True
        assert options.idle_timeout == 3
        assert options.iedriver_version == '3.141.0'
        assert options.max_duration == 300
        assert options.name == 'Sample Test Name'
        assert options.parent_tunnel == 'Mommy'
        assert options.prerun == prerun
        assert options.priority == 0
        assert options.public == 'team'
        assert options.record_logs is False
        assert options.record_screenshots is False
        assert options.record_video is False
        assert options.screen_resolution == '10x10'
        assert options.selenium_version == '3.141.59'
        assert options.tags == tags
        assert options.time_zone == 'San Francisco'
        assert options.tunnel_identifier == 'tunnelname'
        assert options.video_upload_on_pass is False
예제 #3
0
    def test_capabilities_for_selenium(self):
        browser_options = FirefoxOptions()
        browser_options.add_argument('--foo')
        browser_options.set_preference('foo', 'bar')

        options = SauceOptions(seleniumOptions=browser_options)
        options.build = 'Sample Build Name'

        expected_capabilities = {'acceptInsecureCerts': True,
                                 'browserName': 'firefox',
                                 'browserVersion': 'latest',
                                 'platformName': 'Windows 10',
                                 'marionette': True,
                                 'moz:firefoxOptions': {'args': ['--foo'], 'prefs': {'foo': 'bar'}},
                                 'sauce:options': {'build': 'Sample Build Name'}}

        assert options.to_capabilities() == expected_capabilities
예제 #4
0
    def test_capabilities_for_sauce(self):
        prerun = {'executable': 'http://url.to/your/executable.exe',
                  'args': ['--silent', '-a', '-q'],
                  'background': False,
                  'timeout': 120}
        custom_data = {'foo': 'foo',
                       'bar': 'bar'}
        tags = ['foo', 'bar']

        options = SauceOptions()

        options.avoid_proxy = True
        options.build = 'Sample Build Name'
        options.capture_performance = True
        options.chromedriver_version = '71'
        options.command_timeout = 2
        options.custom_data = custom_data
        options.extended_debugging = True
        options.idle_timeout = 3
        options.iedriver_version = '3.141.0'
        options.max_duration = 300
        options.name = 'Sample Test Name'
        options.parent_tunnel = 'Mommy'
        options.prerun = prerun
        options.priority = 0
        options.public = 'team'
        options.record_logs = False
        options.record_screenshots = False
        options.record_video = False
        options.screen_resolution = '10x10'
        options.selenium_version = '3.141.59'
        options.tags = tags
        options.time_zone = 'San Francisco'
        options.tunnel_identifier = 'tunnelname'
        options.video_upload_on_pass = False

        expected_capabilities = {'browserName': 'chrome',
                                 'browserVersion': 'latest',
                                 'platformName': 'Windows 10',
                                 'sauce:options': {'build': 'Sample Build Name',
                                                   'avoidProxy': True,
                                                   'capturePerformance': True,
                                                   'chromedriverVersion': '71',
                                                   'commandTimeout': 2,
                                                   'customData': {'foo': 'foo',
                                                                  'bar': 'bar'},
                                                   'extendedDebugging': True,
                                                   'idleTimeout': 3,
                                                   'iedriverVersion': '3.141.0',
                                                   'maxDuration': 300,
                                                   'name': 'Sample Test Name',
                                                   'parentTunnel': 'Mommy',
                                                   'prerun': prerun,
                                                   'priority': 0,
                                                   'public': 'team',
                                                   'recordLogs': False,
                                                   'recordScreenshots': False,
                                                   'recordVideo': False,
                                                   'screenResolution': '10x10',
                                                   'seleniumVersion': '3.141.59',
                                                   'tags': ['foo', 'bar'],
                                                   'timeZone': 'San Francisco',
                                                   'tunnelIdentifier': 'tunnelname',
                                                   'videoUploadOnPass': False}}

        assert options.to_capabilities() == expected_capabilities