1 | import gnumims.functional.pages.HomePage |
---|
2 | import gnumims.functional.pages.LoginPage |
---|
3 | import gnumims.functional.pages.LogoutPage |
---|
4 | import spock.lang.Stepwise |
---|
5 | import spock.lang.Unroll |
---|
6 | |
---|
7 | @Stepwise |
---|
8 | class LoginSpec extends GebReportingSpecBase { |
---|
9 | |
---|
10 | def "We start at the login page"() { |
---|
11 | when: |
---|
12 | go baseUrl |
---|
13 | |
---|
14 | then: |
---|
15 | at LoginPage |
---|
16 | verifyLoggedOut() |
---|
17 | } |
---|
18 | |
---|
19 | def "When we login, we go to the home page"() { |
---|
20 | when: |
---|
21 | login('admin', 'pass') |
---|
22 | |
---|
23 | then: |
---|
24 | at HomePage |
---|
25 | verifyLoggedIn() |
---|
26 | } |
---|
27 | |
---|
28 | def "When we logout, we go to the logout page"() { |
---|
29 | when: |
---|
30 | logout() |
---|
31 | |
---|
32 | then: |
---|
33 | at LogoutPage |
---|
34 | verifyLoggedOut() |
---|
35 | verifyLogoutMessage() |
---|
36 | } |
---|
37 | |
---|
38 | //@Unroll("Username: '#username' with password: '#password' should fail to login.") |
---|
39 | def "If we type in the wrong password or username"() { |
---|
40 | when: |
---|
41 | login(username, password) |
---|
42 | |
---|
43 | then: |
---|
44 | at LoginPage |
---|
45 | verifyLoggedOut() |
---|
46 | verifyLoginFailureMessage() |
---|
47 | |
---|
48 | cleanup: |
---|
49 | logout() |
---|
50 | |
---|
51 | where: |
---|
52 | username | password |
---|
53 | 'admin' | 'bogus' /* Bogus Password. */ |
---|
54 | 'admin' | '' // None. |
---|
55 | 'admin' | ' ' // Blank. |
---|
56 | 'admin' | 'PASS' // Capitals |
---|
57 | 'admin' | 'Pass' // First Capital. |
---|
58 | 'admin' | 'pasS' // Last Capital. |
---|
59 | 'admin' | 'pas' // One letter short. |
---|
60 | 'admin' | 'passs' // One letter longer. |
---|
61 | 'admin' | ' pass' // Leading space. |
---|
62 | 'admin' | 'pass ' // Trailing space. |
---|
63 | 'admin' | '*' // Star Wildcard. |
---|
64 | 'admin' | '%' // Percentage Wildcard. |
---|
65 | 'admin' | '.' // Dot Wildcard. |
---|
66 | 'admin' | 'pas*' // Star Wildcard in pattern. |
---|
67 | 'admin' | 'pas%' // Percentage Wildcard in pattern. |
---|
68 | 'admin' | 'pas.' // Dot Wildcard in pattern. |
---|
69 | |
---|
70 | 'bogus' | 'pass' /* Bogus Username. */ |
---|
71 | '' | 'pass' // None |
---|
72 | ' ' | 'pass' // Blank |
---|
73 | 'ADMIN' | 'pass' // Capitals |
---|
74 | 'Admin' | 'pass' // First Capital. |
---|
75 | 'admiN' | 'pass' // Last Capital. |
---|
76 | 'admi' | 'pass' // One letter short. |
---|
77 | 'adminn' | 'pass' // One letter longer. |
---|
78 | //' admin' | 'pass' // Leading space. |
---|
79 | //'admin ' | 'pass' // Trailing space. |
---|
80 | '*' | 'pass' // Star Wildcard. |
---|
81 | '%' | 'pass' // Percentage Wildcard. |
---|
82 | '.' | 'pass' // Dot Wildcard. |
---|
83 | 'admi*' | 'pass' // Star Wildcard in pattern. |
---|
84 | 'admi%' | 'pass' // Percentage Wildcard in pattern. |
---|
85 | 'admi.' | 'pass' // Dot Wildcard in pattern. |
---|
86 | } |
---|
87 | |
---|
88 | } |
---|