| 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 | } |
|---|
| 17 | |
|---|
| 18 | def "When we login, we go to the home page"() { |
|---|
| 19 | when: |
|---|
| 20 | login('admin', 'pass') |
|---|
| 21 | |
|---|
| 22 | then: |
|---|
| 23 | at HomePage |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | def "When we logout, we go to the logout page"() { |
|---|
| 27 | when: |
|---|
| 28 | logout.click() |
|---|
| 29 | |
|---|
| 30 | then: |
|---|
| 31 | at LogoutPage |
|---|
| 32 | verifyLogoutMessage() |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | //@Unroll("Username: '#username' with password: '#password' should fail to login.") |
|---|
| 36 | def "If we type in the wrong password or username"() { |
|---|
| 37 | when: |
|---|
| 38 | login(username, password) |
|---|
| 39 | |
|---|
| 40 | then: |
|---|
| 41 | at LoginPage |
|---|
| 42 | verifyLoginFailureMessage() |
|---|
| 43 | |
|---|
| 44 | where: |
|---|
| 45 | username | password |
|---|
| 46 | 'admin' | 'bogus' /* Bogus Password. */ |
|---|
| 47 | 'admin' | '' // None. |
|---|
| 48 | 'admin' | ' ' // Blank. |
|---|
| 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. |
|---|
| 54 | 'admin' | ' pass' // Leading space. |
|---|
| 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. */ |
|---|
| 62 | '' | 'pass' // None |
|---|
| 63 | ' ' | 'pass' // Blank |
|---|
| 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. |
|---|
| 69 | //' admin' | 'pass' // Leading space. |
|---|
| 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. |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | } |
|---|