Пример #1
0
def module_driver_fixture(request):
    previous_fails = request.session.testsfailed
    yield None
    DriverWrappersPool.close_drivers(
        scope='module',
        test_name=os.path.splitext(os.path.basename(request.node.name))[0],
        test_passed=request.session.testsfailed == previous_fails)
Пример #2
0
 def tearDown(self):
     # Call BasicTestCase tearDown
     super(SeleniumTestCase, self).tearDown()
     # Close drivers
     DriverWrappersPool.close_drivers(scope='function',
                                      test_name=self.get_subclassmethod_name(),
                                      test_passed=self._test_passed)
Пример #3
0
 def tearDown(self):
     # Call BasicTestCase tearDown
     super(SeleniumTestCase, self).tearDown()
     # Close drivers
     DriverWrappersPool.close_drivers(
         scope='function',
         test_name=self.get_subclassmethod_name(),
         test_passed=self._test_passed)
Пример #4
0
def driver_wrapper(request):
    default_driver_wrapper = DriverWrappersPool.connect_default_driver_wrapper(
    )
    yield default_driver_wrapper
    DriverWrappersPool.close_drivers(
        scope='function',
        test_name=request.node.name,
        test_passed=not request.node.rep_call.failed)
Пример #5
0
def test_close_drivers_function(scope, driver_wrapper):
    DriverWrappersPool.save_all_webdriver_logs = mock.MagicMock()

    # Close drivers
    DriverWrappersPool.close_drivers(scope, 'test_name')

    if scope == 'function':
        # Check that save_all_webdriver_logs has been called
        DriverWrappersPool.save_all_webdriver_logs.assert_called_once_with('test_name', True)
    else:
        # Check that save_all_webdriver_logs has not been called
        DriverWrappersPool.save_all_webdriver_logs.assert_not_called()
Пример #6
0
def test_close_drivers_function(scope, driver_wrapper):
    DriverWrappersPool.save_all_webdriver_logs = mock.MagicMock()
    VisualTest.update_latest_report = mock.MagicMock()

    # Close drivers
    DriverWrappersPool.close_drivers(scope, 'test_name')

    # Check that save_all_webdriver_logs method has been called only in function scope
    # Check that update_latest_report method has been called only in session scope
    if scope == 'function':
        DriverWrappersPool.save_all_webdriver_logs.assert_called_once_with(
            'test_name', True)
        VisualTest.update_latest_report.assert_not_called()
    elif scope == 'module':
        DriverWrappersPool.save_all_webdriver_logs.assert_not_called()
        VisualTest.update_latest_report.assert_not_called()
    elif scope == 'session':
        DriverWrappersPool.save_all_webdriver_logs.assert_not_called()
        VisualTest.update_latest_report.assert_called_once_with()
Пример #7
0
 def tearDownClass(cls):
     # Call BasicTestCase tearDownClass
     super(SeleniumTestCase, cls).tearDownClass()
     # Close drivers
     DriverWrappersPool.close_drivers(scope='class',
                                      test_name=cls.get_subclass_name())
Пример #8
0
def session_driver_fixture(request):
    yield None
    DriverWrappersPool.close_drivers(
        scope='session',
        test_name=request.node.name,
        test_passed=request.session.testsfailed == 0)
Пример #9
0
 def tearDownClass(cls):
     # Call BasicTestCase tearDownClass
     super(SeleniumTestCase, cls).tearDownClass()
     # Close drivers
     DriverWrappersPool.close_drivers(scope='class', test_name=cls.get_subclass_name())