- Add HVAC_Test_User_Factory class with: * User creation with specific roles * Multiple role support * Persona management system * Account cleanup integration - Create comprehensive test suite in HVAC_Test_User_Factory_Test.php - Update testing improvement plan documentation - Add implementation decisions to project memory bank - Restructure .gitignore with: * Whitelist approach for better file management * Explicit backup exclusions * Specific bin directory inclusions Part of the Account Management component from the testing framework improvement plan.
99 lines
No EOL
4.4 KiB
TypeScript
99 lines
No EOL
4.4 KiB
TypeScript
import { Page, expect } from '@playwright/test';
|
|
import { LogParser } from '../utils/logParser';
|
|
|
|
export class ModifyEventPage {
|
|
readonly page: Page;
|
|
private readonly selectors = {
|
|
// Instructions section
|
|
instructionsSection: '#event-modification-instructions',
|
|
|
|
// Form fields (same as create but with pre-filled values)
|
|
eventNameInput: '#event-name',
|
|
eventDescriptionInput: '#event-description',
|
|
eventDateInput: '#event-date',
|
|
eventTimeInput: '#event-time',
|
|
eventLocationInput: '#event-location',
|
|
eventOrganizerInput: '#event-organizer',
|
|
ticketPriceInput: '#ticket-price',
|
|
ticketQuantityInput: '#ticket-quantity',
|
|
|
|
// Validation messages
|
|
validationError: '.validation-error',
|
|
|
|
// Navigation buttons
|
|
saveChangesButton: '#save-changes-btn',
|
|
returnToDashboardButton: '#return-dashboard-btn'
|
|
};
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async navigate(eventId: string) {
|
|
await this.page.goto(`/wp-admin/admin.php?page=community-events-edit&event_id=${eventId}`);
|
|
}
|
|
|
|
async verifyInstructionsVisibility() {
|
|
const instructions = await this.page.locator(this.selectors.instructionsSection);
|
|
await expect(instructions).toBeVisible();
|
|
}
|
|
|
|
async verifyPrefilledValues(expectedValues: {
|
|
name: string;
|
|
description: string;
|
|
date: string;
|
|
time: string;
|
|
location: string;
|
|
organizer: string;
|
|
ticketPrice: string;
|
|
ticketQuantity: string;
|
|
}) {
|
|
await expect(this.page.locator(this.selectors.eventNameInput)).toHaveValue(expectedValues.name);
|
|
await expect(this.page.locator(this.selectors.eventDescriptionInput)).toHaveValue(expectedValues.description);
|
|
await expect(this.page.locator(this.selectors.eventDateInput)).toHaveValue(expectedValues.date);
|
|
await expect(this.page.locator(this.selectors.eventTimeInput)).toHaveValue(expectedValues.time);
|
|
await expect(this.page.locator(this.selectors.eventLocationInput)).toHaveValue(expectedValues.location);
|
|
await expect(this.page.locator(this.selectors.eventOrganizerInput)).toHaveValue(expectedValues.organizer);
|
|
await expect(this.page.locator(this.selectors.ticketPriceInput)).toHaveValue(expectedValues.ticketPrice);
|
|
await expect(this.page.locator(this.selectors.ticketQuantityInput)).toHaveValue(expectedValues.ticketQuantity);
|
|
}
|
|
|
|
async modifyEventDetails(eventDetails: {
|
|
name?: string;
|
|
description?: string;
|
|
date?: string;
|
|
time?: string;
|
|
location?: string;
|
|
organizer?: string;
|
|
ticketPrice?: string;
|
|
ticketQuantity?: string;
|
|
}) {
|
|
if (eventDetails.name) await this.page.fill(this.selectors.eventNameInput, eventDetails.name);
|
|
if (eventDetails.description) await this.page.fill(this.selectors.eventDescriptionInput, eventDetails.description);
|
|
if (eventDetails.date) await this.page.fill(this.selectors.eventDateInput, eventDetails.date);
|
|
if (eventDetails.time) await this.page.fill(this.selectors.eventTimeInput, eventDetails.time);
|
|
if (eventDetails.location) await this.page.fill(this.selectors.eventLocationInput, eventDetails.location);
|
|
if (eventDetails.organizer) await this.page.fill(this.selectors.eventOrganizerInput, eventDetails.organizer);
|
|
if (eventDetails.ticketPrice) await this.page.fill(this.selectors.ticketPriceInput, eventDetails.ticketPrice);
|
|
if (eventDetails.ticketQuantity) await this.page.fill(this.selectors.ticketQuantityInput, eventDetails.ticketQuantity);
|
|
}
|
|
|
|
async saveChanges() {
|
|
await this.page.click(this.selectors.saveChangesButton);
|
|
}
|
|
|
|
async returnToDashboard() {
|
|
await this.page.click(this.selectors.returnToDashboardButton);
|
|
}
|
|
|
|
async verifyValidationError(field: string, expectedMessage: string) {
|
|
const errorMessage = await this.page.locator(`${this.selectors.validationError}[data-field="${field}"]`);
|
|
await expect(errorMessage).toHaveText(expectedMessage);
|
|
}
|
|
|
|
async verifyPluginIntegration() {
|
|
// Verify The Events Calendar Community Events plugin elements
|
|
await expect(this.page.locator('.tribe-community-events')).toBeVisible();
|
|
await expect(this.page.locator('.tribe-community-events-content')).toBeVisible();
|
|
}
|
|
} |