upskill-event-manager/wordpress-dev/tests/e2e/pages/LoginPage.ts
bengizmo 461304e9f6 docs: Add dashboard improvements documentation
- Create detailed documentation for dashboard UI/UX improvements
- Document row layout for stats section
- Document dynamic event filtering functionality
- Add technical implementation details
- Add testing information

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-19 19:43:23 -03:00

53 lines
No EOL
1.7 KiB
TypeScript

import { Page } from '@playwright/test';
import { BasePage } from './BasePage';
export class LoginPage extends BasePage {
private readonly usernameField = '#user_login';
private readonly passwordField = '#user_pass';
private readonly loginButton = '#wp-submit';
private readonly rememberMeCheckbox = '#rememberme';
private readonly errorMessage = '.hvac-login-error';
private readonly forgotPasswordLink = 'a:has-text("Lost your password")';
constructor(page: Page) {
super(page);
}
async navigate(): Promise<void> {
const STAGING_URL = 'https://wordpress-974670-5399585.cloudwaysapps.com';
await this.page.goto(`${STAGING_URL}/community-login/`);
await this.page.waitForLoadState('networkidle');
}
async navigateToLogin(): Promise<void> {
await this.navigate();
}
async login(username: string, password: string, rememberMe: boolean = false): Promise<void> {
await this.fill(this.usernameField, username);
await this.fill(this.passwordField, password);
if (rememberMe) {
await this.click(this.rememberMeCheckbox);
}
await this.click(this.loginButton);
await this.waitForNavigation();
}
async getErrorMessage(): Promise<string> {
if (await this.isVisible(this.errorMessage)) {
return await this.getText(this.errorMessage);
}
return '';
}
async isLoginFormVisible(): Promise<boolean> {
return await this.isVisible(this.usernameField) &&
await this.isVisible(this.passwordField);
}
async clickForgotPassword(): Promise<void> {
await this.click(this.forgotPasswordLink);
}
}