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

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

Login tests (er, Specs!) that work in grails test-app.

File size: 1.3 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 LoginSpec 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        form.j_username = "admin"
28        form.j_password = "pass"
29        login.click(HomePage)
30
31        then:
32        at(HomePage)
33    }
34
35    def "When we click logout, we go back to the login page"() {
36        when:
37        to HomePage
38        logout.click()
39
40        then:
41        at(LoginPage)
42    }
43
44    def "If we type in the wrong password"() {
45        when:
46        to LoginPage
47        form.j_username = "admin"
48        form.j_password = "bogus"
49        login.click(LoginPage)
50
51        then:
52        $("div.login_message").text() == "[admin] wrong username/password."
53    }
54
55}
Note: See TracBrowser for help on using the repository browser.