From b6f60fd007efc84ef7cc2b63988448a61bbeb8d2 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 17:36:39 -0200 Subject: Add sign up smoke test See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/signup.py | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 service/test/functional/features/steps/signup.py (limited to 'service/test/functional/features/steps/signup.py') diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py new file mode 100644 index 00000000..1252017c --- /dev/null +++ b/service/test/functional/features/steps/signup.py @@ -0,0 +1,45 @@ +# +# Copyright (c) 2016 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 . + +import uuid +from behave import given, then, when + +from common import ( + fill_by_css_selector, + find_element_by_css_selector) + + +@given(u'a user is accessing the signup page') # noqa +def step_impl(context): + context.browser.get(context.signup_url) + + +@when(u'I enter username, password and password confirmation') # noqa +def step_impl(context): + fill_by_css_selector(context, '#srp_username', 'testuser_{}'.format(uuid.uuid4())) + fill_by_css_selector(context, '#srp_password', 'password') + fill_by_css_selector(context, '#srp_password_confirmation', 'password') + + +@when(u'I click on the signup button') # noqa +def step_impl(context): + find_element_by_css_selector(context, 'button[type=submit]').click() + + +@then(u'I should see the user control panel') # noqa +def step_impl(context): + text = find_element_by_css_selector(context, 'h1').text + assert text == 'user control panel' -- cgit v1.2.3 From a8a7362054f4b49ea1fbc00fe7b556e6e6ea4590 Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 19:07:56 -0200 Subject: Add timeout to find by css selector See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/signup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'service/test/functional/features/steps/signup.py') diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py index 1252017c..1558004b 100644 --- a/service/test/functional/features/steps/signup.py +++ b/service/test/functional/features/steps/signup.py @@ -18,6 +18,7 @@ import uuid from behave import given, then, when from common import ( + element_should_have_content, fill_by_css_selector, find_element_by_css_selector) @@ -41,5 +42,4 @@ def step_impl(context): @then(u'I should see the user control panel') # noqa def step_impl(context): - text = find_element_by_css_selector(context, 'h1').text - assert text == 'user control panel' + element_should_have_content(context, 'h1', 'user control panel') -- cgit v1.2.3 From 8372b0127343df96cbe1ca33477ea0f197a873be Mon Sep 17 00:00:00 2001 From: Tulio Casagrande Date: Wed, 30 Nov 2016 19:11:57 -0200 Subject: Add username to behave context See: https://github.com/pixelated/project-issues/issues/381 --- service/test/functional/features/steps/signup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'service/test/functional/features/steps/signup.py') diff --git a/service/test/functional/features/steps/signup.py b/service/test/functional/features/steps/signup.py index 1558004b..43480666 100644 --- a/service/test/functional/features/steps/signup.py +++ b/service/test/functional/features/steps/signup.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . -import uuid from behave import given, then, when from common import ( @@ -30,7 +29,7 @@ def step_impl(context): @when(u'I enter username, password and password confirmation') # noqa def step_impl(context): - fill_by_css_selector(context, '#srp_username', 'testuser_{}'.format(uuid.uuid4())) + fill_by_css_selector(context, '#srp_username', context.username) fill_by_css_selector(context, '#srp_password', 'password') fill_by_css_selector(context, '#srp_password_confirmation', 'password') -- cgit v1.2.3