Changeset 947
- Timestamp:
- May 29, 2011, 10:52:16 AM (14 years ago)
- Location:
- branches/features/purchaseOrders
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/purchaseOrders/grails-app/views/layouts/main.gsp
r942 r947 3 3 <head> 4 4 <title><g:layoutTitle default="gnuMims" /></title> 5 <meta name="pageId" content="${controllerName}.${actionName}" /> 5 6 <link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" /> 6 7 <link rel="shortcut icon" href="${resource(dir:'images',file:'gnuMimsIcon.ico')}" type="image/x-icon" /> -
branches/features/purchaseOrders/test/functional/LoginSpec.groovy
r937 r947 1 1 import gnumims.functional.pages.HomePage 2 2 import gnumims.functional.pages.LoginPage 3 import gnumims.functional.pages.LogoutPage 3 4 import spock.lang.Stepwise 4 5 … … 8 9 def "We start at the login page"() { 9 10 when: 10 go getBaseUrl()11 go baseUrl 11 12 12 13 then: 13 $("h1").text() == "Welcome to gnuMims please log in"14 at LoginPage 14 15 } 15 16 … … 19 20 form.j_username = "admin" 20 21 form.j_password = "pass" 21 login.click( HomePage)22 login.click() 22 23 23 24 then: 24 at (HomePage)25 at HomePage 25 26 } 26 27 27 def "When we click logout, we go back to the loginpage"() {28 def "When we click logout, we go to the logout page"() { 28 29 when: 29 to HomePage30 30 logout.click() 31 31 32 32 then: 33 at(LoginPage) 33 at LogoutPage 34 verifyLogoutMessage() 34 35 } 35 36 … … 39 40 form.j_username = "admin" 40 41 form.j_password = "bogus" 41 login.click( LoginPage)42 login.click() 42 43 43 44 then: 44 $("div.login_message").text() == "[admin] wrong username/password." 45 at LoginPage 46 verifyLoginFailureMessage() 45 47 } 46 48 -
branches/features/purchaseOrders/test/functional/gnumims/functional/pages/HomePage.groovy
r925 r947 1 1 package gnumims.functional.pages 2 2 3 import geb.Page 4 5 class HomePage extends Page { 6 static url = "appCore/start" 7 8 static at = { $("div#menu li.navigation_active").text() == "Home" } 3 class HomePage extends GrailsPage { 4 static controller = "appCore" 5 static action = "start" 9 6 10 7 static content = { 11 8 message { $("div.body div.message").text() } 12 logout(to:Log inPage) { $("a[class=logoutButton]") }9 logout(to:LogoutPage) { $("a[class=logoutButton]") } 13 10 } 14 11 } -
branches/features/purchaseOrders/test/functional/gnumims/functional/pages/LoginPage.groovy
r938 r947 1 1 package gnumims.functional.pages 2 2 3 import geb.Page 4 5 class LoginPage extends Page { 6 static url = "login/auth" 7 8 static at = {$("h1").text() == "Welcome to gnuMims please log in"} 3 class LoginPage extends GrailsPage { 4 static controller = "login" 5 static action = "auth" 9 6 10 7 static content = { 11 login { $('#loginForm input[value=Login]') }8 login(to:HomePage) { $('#loginForm input[value=Login]') } 12 9 form { $("#loginForm") } 13 10 password { $("input[name=j_password]").value() } 11 message { $("div.login_message").text() } 12 } 13 14 def verifyLoginFailureMessage() { 15 assert message.contains("wrong username/password.") 16 return true 14 17 } 15 18 }
Note: See TracChangeset
for help on using the changeset viewer.