upskill-event-manager/wordpress-dev/tests/e2e/pages/LoginPage.ts
bengizmo 57f696e0a8 Implement trainer journey E2E tests (Steps 1-5)
- Add comprehensive trainer journey test implementation
- Cover login, dashboard access, event creation, modification, and deletion
- Fix TinyMCE editor interaction issues
- Handle venue and organizer form fields
- Add proper waits and error handling
- Update documentation with test findings
- Document event persistence issues in staging

Test Status: All trainer journey steps (1-5) are now passing
Key Finding: Events persist to My Events page but not main dashboard

Co-authored-by: Ben Reed <ben@tealmaker.com>
2025-05-18 17:56:23 -03:00

47 lines
No EOL
1.5 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 navigateToLogin(): Promise<void> {
await this.navigate('/community-login/');
}
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);
}
}