-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathRegistrationLifecycle.test.html
113 lines (85 loc) · 3.35 KB
/
RegistrationLifecycle.test.html
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
////////////////////////////////////////////////////////////////////////////////
// Tests:
// - login / logout
// - registration of new user with subseauent login
// - password forgotten function
// => is tested on one domain (functionality of signing two domains is not tested)
#{sienaFixture delete:'all'/}
#{selenium 'Test Registration Lost Password And Login Lifecycle'}
//test registration
clearSession()
open('http://localhost:9000/secure')
assertTextPresent('Login')
open('http://localhost:9000/registration')
assertTextPresent('Register')
//enter invalid email:
type('email', 'test')
type('password', 'test')
type('confirm', 'test')
clickAndWait('submit')
//expect that error is shown
assertTextPresent('Error.')
//now we are entering a correct email - BUT we do not click the TOS checkbox
type('email', '[email protected]')
type('password', 'test')
type('confirm', 'test')
clickAndWait('submit')
//expect that error is shown => accept terms of service
assertTextPresent('Must be checked')
//now we are entering two different passwords
type('email', '[email protected]')
type('password', 'PASSWORD')
type('confirm', 'WRONGPASSWORD')
check('acceptTermsOfService')
clickAndWait('submit')
assertTextPresent('Error.')
//now we are entering a correct email and check tos
//BUT NOW: the password is toooo short...
type('email', '[email protected]')
type('password', 'test')
type('confirm', 'test')
check('acceptTermsOfService')
clickAndWait('submit')
assertTextPresent('Minimum size is 8')
//now we are entering a correct email and check tos => everythings okay...
type('email', '[email protected]')
type('password', 'the_correct_password')
type('confirm', 'the_correct_password')
check('acceptTermsOfService')
clickAndWait('submit')
//check that email was sent to [email protected]
storeLastReceivedEmailBy('[email protected]', 'email')
store('javascript{/http:[^\s]+/.exec(storedVars["email"])[0]}', 'confirmationUrl')
open($[confirmationUrl])
assertTextPresent('Registration successful')
//Oops. Now the user lost the password.
clearSession()
open('http://localhost:9000/registration/lostpassword')
type('email', '[email protected]')
clickAndWait('submit')
//okay check that there is a confirmation message
storeLastReceivedEmailBy('[email protected]', 'email')
store('javascript{/http:[^\s]+/.exec(storedVars["email"])[0]}', 'confirmationUrl')
//cool. open the link url => BUT PW is too short...
open($[confirmationUrl])
//and enter a new password
type('password', 'shortpw')
type('passwordConfirm', 'shortpw')
clickAndWait('submit')
//and check that there is success setting the pw :)
assertTextPresent('Minimum size is 8')
//cool. open the link url
open($[confirmationUrl])
//and enter a new password
type('password', 'newpassword')
type('passwordConfirm', 'newpassword')
clickAndWait('submit')
assertTextPresent('jupp')
//and now log in with new password:
clearSession()
open('/login')
type('username', '[email protected]')
type('password', 'newpassword')
clickAndWait('signin')
assertTextPresent('Welcome')
#{/selenium}