Skip to content
Browse files

Add separate clear_browser function which can be used in tests too.

  • Loading branch information...
1 parent 4776b5c commit 06bd4580a28d619052384b20c3d964777cad5b20 @jone jone committed
Showing with 14 additions and 6 deletions.
  1. +14 −6 ftw/testing/browser.py
View
20 ftw/testing/browser.py
@@ -97,6 +97,19 @@ def browser():
return obj
+def clear_browser():
+ """Clears the browser session. Depending on the driver the browser is
+ completely restarted.
+ """
+
+ if CURRENT_BROWSER_DRIVER != 'zope.testbrowser':
+ obj = browser()
+ obj.cookies.delete()
+ obj.visit('file://about:blank')
+
+ _set_browser(None)
+
+
def get_driver():
return CURRENT_BROWSER_DRIVER
@@ -107,13 +120,8 @@ def shutdown_browser():
return
assert CURRENT_BROWSER_DRIVER is not None
- if CURRENT_BROWSER_DRIVER != 'zope.testbrowser':
- obj = browser()
- obj.cookies.delete()
- obj.visit('file://about:blank')
-
+ clear_browser()
set_browser_driver(None)
- _set_browser(None)
def shutdown_all_browser():

0 comments on commit 06bd458

Please sign in to comment.
Something went wrong with that request. Please try again.