source: branches/features/purchaseOrders/test/functional/gnumims/functional/LoginSpec.groovy @ 927

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

Optimise functional test imports.

File size: 1.3 KB
Line 
1package gnumims.functional
2
3import geb.spock.GebReportingSpec
4import gnumims.functional.pages.HomePage
5import gnumims.functional.pages.LoginPage
6import spock.lang.Stepwise
7
8@Stepwise
9class LoginSpec extends GebReportingSpec {
10    def appName = grails.util.Metadata.current.'app.name'
11    String getBaseUrl() { "http://localhost:8080/$appName/" }
12    File getReportDir() { new File("target/reports/geb") }
13
14    def "We start at the login page"() {
15        when:
16        go getBaseUrl()
17
18        then:
19        $("h1").text() == "Welcome to gnuMims please log in"
20    }
21
22    def "When we click login we go to the home page"() {
23        when:
24        to LoginPage
25        form.j_username = "admin"
26        form.j_password = "pass"
27        login.click(HomePage)
28
29        then:
30        at(HomePage)
31    }
32
33    def "When we click logout, we go back to the login page"() {
34        when:
35        to HomePage
36        logout.click()
37
38        then:
39        at(LoginPage)
40    }
41
42    def "If we type in the wrong password"() {
43        when:
44        to LoginPage
45        form.j_username = "admin"
46        form.j_password = "bogus"
47        login.click(LoginPage)
48
49        then:
50        $("div.login_message").text() == "[admin] wrong username/password."
51    }
52
53}
Note: See TracBrowser for help on using the repository browser.