source: branches/features/purchaseOrders/test/functional/LoginSpec.groovy

Last change on this file was 952, checked in by gav, 13 years ago

Functional tests, refactor login/logout.

File size: 2.7 KB
RevLine 
[901]1import gnumims.functional.pages.HomePage
[927]2import gnumims.functional.pages.LoginPage
[947]3import gnumims.functional.pages.LogoutPage
[901]4import spock.lang.Stepwise
[950]5import spock.lang.Unroll
[901]6
7@Stepwise
[929]8class 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
[952]16        verifyLoggedOut()
[901]17    }
18
[948]19    def "When we login, we go to the home page"() {
[901]20        when:
[948]21        login('admin', 'pass')
[901]22
23        then:
[947]24        at HomePage
[952]25        verifyLoggedIn()
[901]26    }
27
[948]28    def "When we logout, we go to the logout page"() {
[901]29        when:
[952]30        logout()
[901]31
32        then:
[947]33        at LogoutPage
[952]34        verifyLoggedOut()
[947]35        verifyLogoutMessage()
[901]36    }
37
[950]38    //@Unroll("Username: '#username' with password: '#password' should fail to login.")
[949]39    def "If we type in the wrong password or username"() {
[951]40        when:
[949]41        login(username, password)
[951]42
43        then:
[947]44        at LoginPage
[952]45        verifyLoggedOut()
[947]46        verifyLoginFailureMessage()
[949]47
[952]48        cleanup:
49        logout()
50
[949]51        where:
52        username  | password
53        'admin'   | 'bogus' /* Bogus Password. */
[950]54        'admin'   | ''      // None.
55        'admin'   | ' '      // Blank.
[949]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.
[950]61        'admin'   | ' pass' // Leading space.
[949]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.
[952]68        'admin'   | 'pas.'  // Dot Wildcard in pattern.
69
[949]70        'bogus'   | 'pass'  /* Bogus Username. */
[950]71        ''        | 'pass'  // None
72        ' '       | 'pass'  // Blank
[949]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.
[950]78        //' admin'  | 'pass' // Leading space.
[949]79        //'admin '  | 'pass' // Trailing space.
80        '*'       | 'pass'  // Star Wildcard.
81        '%'       | 'pass'  // Percentage Wildcard.
[952]82        '.'       | 'pass'  // Dot Wildcard.
[949]83        'admi*'   | 'pass'  // Star Wildcard in pattern.
84        'admi%'   | 'pass'  // Percentage Wildcard in pattern.
[952]85        'admi.'   | 'pass'  // Dot Wildcard in pattern.
[901]86    }
87
88}
Note: See TracBrowser for help on using the repository browser.