def test__define_drivers(self):
        """Verify that _define_drivers returns the correct values"""

        drivers = ['chrome', 'chrome_60_mac']
        
        expected = [
            {
                'name': 'chrome',
                'full_name': None,
                'remote': False,
                'capabilities': None
            },
            {
                'name': 'chrome',
                'full_name': 'chrome_60_mac',
                'remote': True,
                'capabilities': {
                    'browserName': 'chrome',
                    'version': '60.0',
                    'platform': 'macOS 10.12'
                }
            }
        ]

        drivers_defined = start_execution._define_drivers(drivers, self.remote_drivers,
                                                          self.default_drivers)
        assert drivers_defined == expected
    def test__define_drivers_drivers_empty(self):
        """Verify that _define_drivers returns correct value 
        when selected drivers is empty
        """
        drivers = []
        expected = []

        drivers_defined = start_execution._define_drivers(drivers, self.remote_drivers,
                                                          self.default_drivers)
        assert drivers_defined == expected
Exemple #3
0
    def test__define_drivers_drivers_empty(self):
        """Verify that _define_drivers returns correct value 
        when selected drivers is empty
        """
        drivers = []
        expected = []

        drivers_defined = start_execution._define_drivers(
            drivers, self.remote_drivers, self.default_drivers)
        assert drivers_defined == expected
    def test__define_drivers_driver_is_not_defined(self):
        """Verify that _define_drivers raises the correct exception
        when a driver name that is not defined is passed
        """
        drivers = ['not_defined']

        expected_msg = ['Error: the browser {} is not defined\n'.format('not_defined'),
                        'available options are:\n',
                        '\n'.join(self.default_drivers),
                        '\n'.join(list(self.remote_drivers.keys()))]
        expected_msg = ''.join(expected_msg)

        with pytest.raises(Exception) as excinfo:      
            drivers_defined = start_execution._define_drivers(drivers,
                                                              self.remote_drivers,
                                                              self.default_drivers)
        assert str(excinfo.value) == expected_msg
Exemple #5
0
    def test__define_drivers_driver_is_not_defined(self):
        """Verify that _define_drivers raises the correct exception
        when a driver name that is not defined is passed
        """
        drivers = ['not_defined']

        expected_msg = [
            'Error: the browser {} is not defined\n'.format('not_defined'),
            'available options are:\n', '\n'.join(self.default_drivers),
            '\n'.join(list(self.remote_drivers.keys()))
        ]
        expected_msg = ''.join(expected_msg)

        with pytest.raises(Exception) as excinfo:
            drivers_defined = start_execution._define_drivers(
                drivers, self.remote_drivers, self.default_drivers)
        assert str(excinfo.value) == expected_msg
Exemple #6
0
    def test__define_drivers_driver_order_of_preference(self):
        """Verify that _define_drivers selects the drivers in the correct
        order of precedence, first remote drivers then predefined drivers"""
        remote_drivers = {
            'chromex': {
                'browserName': 'chrome',
                'version': '60.0',
                'platform': 'macOS 10.12'
            }
        }

        default_drivers = ['chromex']

        drivers = ['chromex']

        drivers_defined = start_execution._define_drivers(
            drivers, remote_drivers, default_drivers)
        assert len(drivers_defined) == 1
        assert drivers_defined[0]['remote'] == True
        assert drivers_defined[0]['capabilities']['version'] == '60.0'
    def test__define_drivers_driver_order_of_preference(self):
        """Verify that _define_drivers selects the drivers in the correct
        order of precedence, first remote drivers then predefined drivers"""
        remote_drivers = {
            'chromex': {
                'browserName': 'chrome',
                'version': '60.0',
                'platform': 'macOS 10.12'
            }
        }

        default_drivers = ['chromex']

        drivers = ['chromex']
   
        drivers_defined = start_execution._define_drivers(drivers,
                                                          remote_drivers,
                                                          default_drivers)
        assert len(drivers_defined) == 1
        assert drivers_defined[0]['remote'] == True
        assert drivers_defined[0]['capabilities']['version'] == '60.0'
Exemple #8
0
    def test__define_drivers(self):
        """Verify that _define_drivers returns the correct values"""

        drivers = ['chrome', 'chrome_60_mac']

        expected = [{
            'name': 'chrome',
            'full_name': None,
            'remote': False,
            'capabilities': {}
        }, {
            'name': 'chrome',
            'full_name': 'chrome_60_mac',
            'remote': True,
            'capabilities': {
                'browserName': 'chrome',
                'version': '60.0',
                'platform': 'macOS 10.12'
            }
        }]

        drivers_defined = start_execution._define_drivers(
            drivers, self.remote_drivers, self.default_drivers)
        assert drivers_defined == expected