So all I want to do is automate a login through WebdriverIO.
This is the LoginPage class where the error occurs, login function - "element not interactable"
class LoginPage {
get inputUsername() {
const username = $("#username");
username.waitForClickable();
return username;
}
get inputPassword() {
const password = $("#current-password");
password.waitForClickable();
return password;
}
get btnSubmit() {
const submitButton = $(".button.button--primary.button--l");
submitButton.waitForClickable();
return submitButton;
}
async login(username, password) {
await this.inputUsername.setValue(username); //<--Throws error
await this.inputPassword.setValue(password); //<--Throws error
await this.btnSubmit.click(); //<--Not sure if throws error
}
}
The parameters from the login function come from the call of it on the test file.
describe("login", () => {
it("should successfully login", async () => {
await browser.maximizeWindow();
await LoginPage.open(); //<--Opens the login page on the browser
await LoginPage.login(
"emailtest@test.com",
process.env.PASSWORD
);
await expect(browser).toHaveUrl(process.env.CLIENT_AREA_URL);
}
}
I believe I'm using mocha for the test structure and for the reporters (spec and allure), correct me if I'm wrong in something.
I'm kinda new in Automated Web Testing, can someone help me on this?