Skip to content

Instantly share code, notes, and snippets.

@rickschubert
Last active October 20, 2018 17:30
Show Gist options
  • Save rickschubert/2f512f96d49dbf08b05eef44636ff90e to your computer and use it in GitHub Desktop.
Save rickschubert/2f512f96d49dbf08b05eef44636ff90e to your computer and use it in GitHub Desktop.
Standard page object pattern
// Login.page.js
class LoginPage {
get username() { return '#username' }
get password() { return '#password' }
get submit() { return '#login' }
login() {
browser.setValue(this.username, "R2D2")
browser.setValue(this.password, "c3po")
browser.click(this.submit)
}
}
export default new LoginPage()
// Inside test file
import LoginPage from "./pages/Login.page.js"
LoginPage.login()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment