Skip to content

Instantly share code, notes, and snippets.

@pbernet
Created October 23, 2012 16:05
Show Gist options
  • Save pbernet/3939683 to your computer and use it in GitHub Desktop.
Save pbernet/3939683 to your computer and use it in GitHub Desktop.
LoginPage
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