summaryrefslogtreecommitdiff
path: root/service/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/functional')
-rw-r--r--service/test/functional/features/environment.py19
-rw-r--r--service/test/functional/features/page_objects/__init__.py1
-rw-r--r--service/test/functional/features/page_objects/inbox_page.py2
-rw-r--r--service/test/functional/features/steps/login.py4
4 files changed, 18 insertions, 8 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index bc2e1283..379583bc 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -30,6 +30,7 @@ from pixelated.resources.features_resource import FeaturesResource
from test.support.integration import AppTestClient
from steps.common import DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S
from steps import utils
+from ..page_objects import BackupAccountPage
class UnsuportedWebDriverError(Exception):
@@ -135,12 +136,21 @@ def after_feature(context, feature):
def after_step(context, step):
- _debug_on_error(context, step)
- _save_screenshot(context, step)
+ if step.status == 'failed':
+ _debug_on_error(context, step)
+ _save_screenshot(context, step)
+ _logout(context, step)
+
+
+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 _debug_on_error(context, step):
- if step.status == 'failed' and context.config.userdata.getbool("debug"):
+ if context.config.userdata.getbool("debug"):
try:
import ipdb
ipdb.post_mortem(step.exc_traceback)
@@ -150,8 +160,7 @@ def _debug_on_error(context, step):
def _save_screenshot(context, step):
- if (step.status == 'failed' and
- context.config.userdata.getbool("screenshots", True)):
+ if context.config.userdata.getbool("screenshots", True):
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S")
filename = _slugify('{} failed {}'.format(timestamp, str(step.name)))
filepath = os.path.join('screenshots', filename + '.png')
diff --git a/service/test/functional/features/page_objects/__init__.py b/service/test/functional/features/page_objects/__init__.py
index 920bf541..af50948c 100644
--- a/service/test/functional/features/page_objects/__init__.py
+++ b/service/test/functional/features/page_objects/__init__.py
@@ -17,3 +17,4 @@
from account_recovery_page import AccountRecoveryPage
from base_page import BasePage
from inbox_page import InboxPage
+from backup_account_page import BackupAccountPage
diff --git a/service/test/functional/features/page_objects/inbox_page.py b/service/test/functional/features/page_objects/inbox_page.py
index 67ef1375..a6b5fef7 100644
--- a/service/test/functional/features/page_objects/inbox_page.py
+++ b/service/test/functional/features/page_objects/inbox_page.py
@@ -15,7 +15,7 @@
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
from base_page import BasePage
-from common import execute_ignoring_staleness
+from steps.common import execute_ignoring_staleness
class InboxPage(BasePage):
diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py
index a9dbb257..338550b3 100644
--- a/service/test/functional/features/steps/login.py
+++ b/service/test/functional/features/steps/login.py
@@ -57,8 +57,8 @@ def see_interstitial(context):
@then(u'I should see the inbox')
-def see_interstitial(context):
- find_element_by_css_selector(context, 'ul#mail-list')
+def see_inbox(context):
+ _see_inbox(context)
@then(u'I logout')