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