示例#1
0
 def test_set_selenium_timeout_only_affects_open_browsers(self):
     bm = BrowserManagementKeywords()
     first_browser, second_browser = mock(), mock()
     bm._cache.register(first_browser)
     bm._cache.close()
     verify(first_browser).quit()
     bm._cache.register(second_browser)
     bm.set_selenium_timeout("10 seconds")
     verify(second_browser).set_script_timeout(10.0)
     bm._cache.close_all()
     verify(second_browser).quit()
     bm.set_selenium_timeout("20 seconds")
     verifyNoMoreInteractions(first_browser)
     verifyNoMoreInteractions(second_browser)
 def test_set_selenium_timeout_only_affects_open_browsers(self):
     ctx = mock()
     ctx._timeout_in_secs = 5.0
     _browsers = mock()
     ctx._browsers = _browsers
     first_browser, second_browser = mock(), mock()
     when(_browsers).get_open_browsers().thenReturn(
         [first_browser, second_browser]
     )
     bm = BrowserManagementKeywords(ctx)
     bm.set_selenium_timeout("10 seconds")
     verify(first_browser).set_script_timeout(10.0)
     verify(second_browser).set_script_timeout(10.0)
     when(_browsers).get_open_browsers().thenReturn(
         []
     )
     bm.set_selenium_timeout("20 seconds")
     verifyNoMoreInteractions(first_browser)
     verifyNoMoreInteractions(second_browser)
     unstub()