1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#
# 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 <http://www.gnu.org/licenses/>.
import uuid
from behave import given, then, when
from common import (
element_should_have_content,
fill_by_css_selector,
find_element_by_css_selector)
@given(u'a user is accessing the signup page') # noqa
def access_signup_page(context):
context.browser.get(context.signup_url)
@given(u'I am an existent Pixelated user')
def setup_user(context):
access_signup_page(context)
enter_user_information(context)
click_signup_button(context)
see_user_control_panel(context)
@when(u'I enter username, password and password confirmation') # noqa
def enter_user_information(context):
username = 'testuser_{}'.format(uuid.uuid4())
fill_by_css_selector(context, '#srp_username', username)
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 click_signup_button(context):
find_element_by_css_selector(context, 'button[type=submit]').click()
@then(u'I should see the user control panel') # noqa
def see_user_control_panel(context):
element_should_have_content(context, 'h1', 'user control panel')
|