Adding object selectors
The TestClass
test class utilizes the exported instances of the page classes. In the test case, we interact with the web pages using the methods defined in the page objects.
// LoginPage.ts
LoginPage
: This class encapsulates the properties and behaviors of it respective web pages:
class LoginPage { get usernameField() { return $('#username'); } get passwordField() { return $('#password'); } get loginButton() { return $('#login'); } enterUsername(username) { this.usernameField.setValue(username); } enterPassword(password) { this.passwordField.setValue(password); } clickLoginButton() { this.loginButton.click(); } } module.exports = new LoginPage();
// HomePage.ts
HomePage
: This class encapsulates the properties and behaviors of their respective...