external-services-automation
Version:
External services automation library for Playwright and Cucumber
42 lines (41 loc) • 1.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PasswordSetupPage = void 0;
const test_1 = require("@playwright/test");
class PasswordSetupPage {
constructor(page) {
this.page = page;
this.pageTitle = page.locator('h1:has-text("Password setup")');
this.passwordInput = page.locator('input[name="p_first_password"]');
this.confirmPasswordInput = page.locator('input[name="p_second_password"]');
this.continueButton = page.locator('button[type="submit"]:has-text("Continue")');
this.dontUseMFAButton = page.locator('//button[contains(text(), "multi-factor authentication")]');
}
async enterPassword(password) {
await this.passwordInput.fill(password);
}
async enterConfirmPassword(password) {
await this.confirmPasswordInput.fill(password);
}
async clickContinue() {
await this.continueButton.click();
}
async submitPasswordForm(password) {
await this.enterPassword(password);
await this.enterConfirmPassword(password);
await this.clickContinue();
}
async isOnPasswordSetupPage() {
await (0, test_1.expect)(this.pageTitle).toBeVisible();
await (0, test_1.expect)(this.passwordInput).toBeVisible();
await (0, test_1.expect)(this.confirmPasswordInput).toBeVisible();
await (0, test_1.expect)(this.continueButton).toBeVisible();
}
async dontUseMFA() {
await this.page.waitForTimeout(3000);
if (await this.dontUseMFAButton.isVisible()) {
await this.dontUseMFAButton.click();
}
}
}
exports.PasswordSetupPage = PasswordSetupPage;