summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSriram Viswanathan <sriramv@thoughtworks.com>2017-03-23 21:01:58 -0300
committerSriram Viswanathan <sriramv@thoughtworks.com>2017-03-23 21:11:05 -0300
commit22c78cfd258e052958951e528f22bfb04fcb843d (patch)
treed7d57fdf3c2da82f9aeb250bae4c7f18d594a4db
parenteafa3efb5073c3c6bbf933decbf094b27edc7e99 (diff)
|#973| Thais + Sriram | Functional test for logout from the page header
-rw-r--r--service/test/functional/features/environment.py2
-rw-r--r--service/test/functional/features/smoke.feature9
-rw-r--r--service/test/functional/features/steps/backup_account.py22
-rw-r--r--service/test/functional/features/steps/login.py5
4 files changed, 38 insertions, 0 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py
index 821a762b..9f8507b2 100644
--- a/service/test/functional/features/environment.py
+++ b/service/test/functional/features/environment.py
@@ -54,11 +54,13 @@ def before_all(context):
hostname = urlparse(context.host).hostname
context.signup_url = 'https://{}/signup'.format(hostname)
context.login_url = 'https://mail.{}/login'.format(hostname)
+ context.backup_account_url = 'https://mail.{}/backup-account'.format(hostname)
context.username = 'testuser_{}'.format(uuid.uuid4())
if 'localhost' in context.host:
_mock_user_agent(context)
context.login_url = context.multi_user_url + '/login'
+ context.backup_account_url = context.single_user_url + '/backup-account'
context.username = 'username'
diff --git a/service/test/functional/features/smoke.feature b/service/test/functional/features/smoke.feature
index 724c680c..1467baf9 100644
--- a/service/test/functional/features/smoke.feature
+++ b/service/test/functional/features/smoke.feature
@@ -34,3 +34,12 @@ Feature: sign up, login and logout
Then I have mails
When I logout
Then I should see the login page
+
+ Scenario: Existing user logs in and logs out from the header
+ Given a user is accessing the login page
+ When I enter username and password as credentials
+ And I click on the login button
+ Then I should see the fancy interstitial
+ Given I am on the backup account page
+ When I logout from the header
+ Then I should see the login page
diff --git a/service/test/functional/features/steps/backup_account.py b/service/test/functional/features/steps/backup_account.py
new file mode 100644
index 00000000..914309f2
--- /dev/null
+++ b/service/test/functional/features/steps/backup_account.py
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2017 ThoughtWorks, Inc.
+#
+# Pixelated is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pixelated is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
+
+from behave import given
+
+
+@given(u'I am on the backup account page')
+def backup_account_page(context):
+ context.browser.get(context.backup_account_url)
diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py
index 9ce37370..2d7be259 100644
--- a/service/test/functional/features/steps/login.py
+++ b/service/test/functional/features/steps/login.py
@@ -48,6 +48,11 @@ def click_logout(context):
find_element_by_css_selector(context, '#logout-form div').click()
+@when(u'I logout from the header')
+def click_logout(context):
+ find_element_by_css_selector(context, 'button[name="logout"]').click()
+
+
@then(u'I should see the login page')
def see_login_page(context):
find_element_by_css_selector(context, 'form#login_form')