Includes logout after scenarios
authorThais Siqueira <thais.siqueira@gmail.com>
Tue, 25 Apr 2017 19:35:40 +0000 (16:35 -0300)
committerThais Siqueira <thais.siqueira@gmail.com>
Wed, 26 Apr 2017 14:34:38 +0000 (11:34 -0300)
with @tayanefernandes

service/test/functional/features/environment.py

index 379583b..98c7fa9 100644 (file)
@@ -135,18 +135,20 @@ def after_feature(context, feature):
         context.last_mail = None
 
 
+def after_scenario(context, scenario):
+    _logout(context)
+    context.browser.refresh()
+
+
 def after_step(context, step):
     if step.status == 'failed':
         _debug_on_error(context, step)
         _save_screenshot(context, step)
-        _logout(context, step)
+        _logout(context)
 
 
-def _logout(context, step):
-    if context.browser.current_url == context.inbox_url:
-        utils.log_out()
-    elif context.browser.current_url == context.backup_account_url:
-        BackupAccountPage().logout()
+def _logout(context):
+    context.browser.delete_all_cookies()
 
 
 def _debug_on_error(context, step):