"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperateLoginPage = void 0;
const test_1 = require("@playwright/test");
class OperateLoginPage {
    page;
    usernameInput;
    passwordInput;
    loginButton;
    constructor(page) {
        this.page = page;
        this.usernameInput = page.getByLabel('Username');
        this.passwordInput = page.getByRole('textbox', { name: 'password' });
        this.loginButton = page.getByRole('button', { name: 'Login' });
    }
    async fillUsername(username) {
        await this.usernameInput.fill(username);
    }
    async clickUsername() {
        await this.usernameInput.click({ timeout: 60000 });
    }
    async fillPassword(password) {
        await this.passwordInput.fill(password);
    }
    async clickLoginButton() {
        await this.loginButton.click({ timeout: 60000 });
    }
    async login(username, password) {
        await (0, test_1.expect)(this.usernameInput).toBeVisible({ timeout: 180000 });
        await this.clickUsername();
        await this.fillUsername(username);
        await this.fillPassword(password);
        await (0, test_1.expect)(this.loginButton).toBeVisible({ timeout: 120000 });
        await this.clickLoginButton();
    }
}
exports.OperateLoginPage = OperateLoginPage;
