external-services-automation
Version:
External services automation library for Playwright and Cucumber
43 lines (42 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoginPage = void 0;
class LoginPage {
constructor(page) {
this.page = page;
this.emailInput = page.locator('#sign_up_sign_in_credentials_p_email');
this.nextButton = page.locator('.kinde-button.kinde-button-variant-primary');
this.passwordInput = page.locator('#verify_password_p_password');
this.email_not_exists = page.locator('#sign_up_sign_in_credentials_p_email_error_msg');
this.createAccountLink = page.locator('.kinde-text-link[href*="register"]');
}
async navigate() {
await this.page.goto('/login');
}
async enterEmail(email) {
await this.emailInput.fill(email);
await this.nextButton.click();
await this.page.waitForTimeout(2000);
}
async enterPassword(password) {
await this.passwordInput.fill(password);
await this.nextButton.click();
await this.page.waitForTimeout(3000);
}
async getEmailNotExistsMessage() {
return await this.email_not_exists.textContent();
}
async login(email, password) {
if (!email) {
throw new Error(`${email} is not set`);
}
await this.enterEmail(email);
if (password) {
await this.enterPassword(password);
}
}
async goToRegisterPage() {
await this.createAccountLink.click();
}
}
exports.LoginPage = LoginPage;