Last change
on this file since 928 was
928,
checked in by gav, 13 years ago
|
Change Geb reports dir to under test-reports.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[901] | 1 | package gnumims.functional |
---|
| 2 | |
---|
| 3 | import geb.spock.GebReportingSpec |
---|
| 4 | import gnumims.functional.pages.HomePage |
---|
[927] | 5 | import gnumims.functional.pages.LoginPage |
---|
[901] | 6 | import spock.lang.Stepwise |
---|
| 7 | |
---|
| 8 | @Stepwise |
---|
[912] | 9 | class LoginSpec extends GebReportingSpec { |
---|
[925] | 10 | def appName = grails.util.Metadata.current.'app.name' |
---|
| 11 | String getBaseUrl() { "http://localhost:8080/$appName/" } |
---|
[928] | 12 | File getReportDir() { new File("target/test-reports/geb-pages") } |
---|
[901] | 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 |
---|
[912] | 25 | form.j_username = "admin" |
---|
| 26 | form.j_password = "pass" |
---|
[901] | 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 |
---|
[912] | 45 | form.j_username = "admin" |
---|
[901] | 46 | form.j_password = "bogus" |
---|
| 47 | login.click(LoginPage) |
---|
| 48 | |
---|
| 49 | then: |
---|
[912] | 50 | $("div.login_message").text() == "[admin] wrong username/password." |
---|
[901] | 51 | } |
---|
| 52 | |
---|
| 53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.