Need assistance in identifying an error. Currently, I am learning Protractor and attempting to create a basic test using Page Object.
//login_pageObject.js
let loginContainer = function() {
this.usernameInput = $("input.login-form-01");
this.passwordInput = $("input#login-form-02");
this.loginBtn = $("input.btn");
this.get = function() {
browser.get("https://www.cosmedicalsupplies.com/login.html");
};
this.setUsername = function(username) {
usernameInput.sendKeys(username);
};
this.setPassword = function(password) {
passwordInput.sendKeys(password);
};
this.clickOnLoginBtn = function() {
loginBtn.click();
};
};
module.exports = new loginContainer();
Additionally,
//login.js
let loginPage = require('../page_objects/login_pageObject.js');
describe('login_logout autotests', () => {
beforeEach(() => {
browser.ignoreSynchronization = true;
});
it("should sign in", () => {
loginPage.get();
loginPage.setUsername("test1");
loginPage.setPassword("test2");
loginPage.clickOnLoginBtn();
//expect.....
});
});
Upon running the code, I encounter a "Failed: usernameInput is not defined" error. Could you please point out where the mistake lies?