source: branches/features/purchaseOrders/test/functional/gnumims/functional/LoginTests.groovy @ 901

Last change on this file since 901 was 901, checked in by JohnYesberg, 13 years ago

Geb and spock infrastructure in place. Some initial login tests

File size: 1.2 KB
Line 
1package gnumims.functional
2
3import grails.plugin.geb.GebSpec
4import gnumims.functional.pages.LoginPage
5import geb.spock.GebReportingSpec
6import geb.Browser
7import geb.junit3.GebTest
8import gnumims.functional.pages.HomePage
9import spock.lang.Stepwise
10
11@Stepwise
12class LoginTests extends GebReportingSpec {
13    String getBaseUrl() { "http://localhost:8080/gnumims" }
14    File getReportDir() { new File("target/reports/geb") }
15
16    def "We start at the login page"() {
17        when:
18        go getBaseUrl()
19
20        then:
21        $("h1").text() == "Welcome to gnuMims please log in"
22    }
23
24    def "When we click login we go to the home page"() {
25        when:
26        to LoginPage
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_password = "bogus"
46        login.click(LoginPage)
47
48        then:
49        $("div.login_message").text() == "[manager] wrong username/password."
50    }
51
52}
Note: See TracBrowser for help on using the repository browser.