upskill-event-manager/wordpress-dev/tests/e2e/pages/ModifyEventPage.ts
Ben Reed 04dcc32919 feat(testing): Implement comprehensive trainer journey test suite with Page Object Model
- Created Page Object Model structure for all trainer-facing pages
- Implemented complete test coverage for trainer journey steps 1-8
- Added centralized test data management with test users and events
- Updated run-tests.sh with --trainer-journey option for easy execution
- Enhanced documentation with test setup, usage, and troubleshooting guides
- Created verification scripts to ensure proper test environment setup
- Prepared framework for Phase 2/3 features (email, check-in, certificates)

This implementation provides a solid foundation for testing the complete trainer user journey and can be easily extended as new features are deployed.
2025-05-18 15:42:00 -03:00

35 lines
No EOL
1.1 KiB
TypeScript

import { Page } from '@playwright/test';
import { CreateEventPage } from './CreateEventPage';
export class ModifyEventPage extends CreateEventPage {
private readonly updateButton = 'input[name="community-event"][value="Update"]';
private readonly deleteButton = 'a:has-text("Delete Event")';
private readonly confirmDeleteButton = 'button:has-text("Yes, Delete")';
constructor(page: Page) {
super(page);
}
async navigateToModifyEvent(eventId: string): Promise<void> {
await this.navigate(`/modify-event/?event_id=${eventId}`);
}
async updateEvent(): Promise<void> {
await this.click(this.updateButton);
await this.waitForNavigation();
}
async deleteEvent(confirm: boolean = true): Promise<void> {
await this.click(this.deleteButton);
if (confirm) {
await this.waitForElement(this.confirmDeleteButton);
await this.click(this.confirmDeleteButton);
await this.waitForNavigation();
}
}
async isUpdateButtonVisible(): Promise<boolean> {
return await this.isVisible(this.updateButton);
}
}