Created
October 23, 2012 16:05
-
-
Save pbernet/3939683 to your computer and use it in GitHub Desktop.
LoginPage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package xx.testcase.gui.pageobjects.page | |
import org.openqa.selenium.WebDriverBackedSelenium | |
import xx.testcase.gui.util.I18N | |
class LoginPage(sel: WebDriverBackedSelenium) extends CareWebPage { | |
def selenium = sel | |
def isAt = selenium.getTitle.contains(I18N.getOrEmpty("config.login.title")) | |
def url = "login" | |
def loginAs(username: String, password: String): ConfigPage = { | |
submitForm(username, password) | |
sel.waitForPageToLoad("30000") | |
new ConfigPage(sel) | |
} | |
def unableToLoginWith(username: String, password: String): String = { | |
submitForm(username, password) | |
sel.getText("id=messagecontainer") | |
} | |
private def submitForm(username: String, password: String) { | |
sel.open("/login") | |
sel.`type`("username", username) | |
sel.`type`("password", password) | |
sel.submit("submitForm") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment