diff options
-rw-r--r-- | service/test/functional/features/environment.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 07b733de..e753fca9 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -18,6 +18,7 @@ import uuid from crochet import setup, wait_for from leap.common.events.server import ensure_server +from twisted.internet import defer from test.support.dispatcher.proxy import Proxy from test.support.integration import AppTestClient from selenium import webdriver @@ -63,10 +64,22 @@ def after_step(context, step): context.browser.save_screenshot('failed ' + str(step.name) + '_' + id + ".png") save_source(context, 'failed ' + str(step.name) + '_' + id + ".html") - def after_feature(context, feature): context.browser.quit() + cleanup_all_mails(context) + context.last_mail = None + +@wait_for(timeout=10.0) +def cleanup_all_mails(context): + @defer.inlineCallbacks + def _delete_all_mails(): + mails = yield context.client.mail_store.all_mails() + for mail in mails: + yield context.client.mail_store.delete_mail(mail.ident) + + return _delete_all_mails() + def save_source(context, filename='/tmp/source.html'): with open(filename, 'w') as out: |