- 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.
125 lines
No EOL
5 KiB
TypeScript
125 lines
No EOL
5 KiB
TypeScript
import { Page, expect } from '@playwright/test';
|
|
import { LogParser } from '../utils/logParser';
|
|
|
|
export class EventSummaryPage {
|
|
readonly page: Page;
|
|
private readonly selectors = {
|
|
// Navigation buttons
|
|
editEventButton: '#edit-event-btn',
|
|
returnToDashboardButton: '#return-dashboard-btn',
|
|
|
|
// Event details sections
|
|
eventTitle: '#event-title',
|
|
eventDateTime: '#event-datetime',
|
|
eventLocation: '#event-location',
|
|
eventOrganizer: '#event-organizer',
|
|
eventDescription: '#event-description',
|
|
|
|
// Tickets section
|
|
ticketPrice: '#ticket-price',
|
|
ticketQuantity: '#ticket-quantity',
|
|
ticketsRemaining: '#tickets-remaining',
|
|
|
|
// Transactions table
|
|
transactionsTable: '#transactions-table',
|
|
purchaserNameLinks: '.purchaser-name-link',
|
|
organizationCells: '.organization-cell',
|
|
purchaseDateCells: '.purchase-date-cell',
|
|
ticketCountCells: '.ticket-count-cell',
|
|
revenueCells: '.revenue-cell',
|
|
|
|
// Summary statistics
|
|
totalTicketsSold: '#total-tickets-sold',
|
|
totalRevenue: '#total-revenue'
|
|
};
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async navigate(eventId: string) {
|
|
await this.page.goto(`/wp-admin/admin.php?page=event-summary&event_id=${eventId}`);
|
|
}
|
|
|
|
// Navigation methods
|
|
async clickEditEvent() {
|
|
await this.page.click(this.selectors.editEventButton);
|
|
}
|
|
|
|
async returnToDashboard() {
|
|
await this.page.click(this.selectors.returnToDashboardButton);
|
|
}
|
|
|
|
// Event details verification methods
|
|
async verifyEventDetails(expectedDetails: {
|
|
title: string;
|
|
dateTime: string;
|
|
location: string;
|
|
organizer: string;
|
|
description: string;
|
|
}) {
|
|
await expect(this.page.locator(this.selectors.eventTitle)).toHaveText(expectedDetails.title);
|
|
await expect(this.page.locator(this.selectors.eventDateTime)).toHaveText(expectedDetails.dateTime);
|
|
await expect(this.page.locator(this.selectors.eventLocation)).toHaveText(expectedDetails.location);
|
|
await expect(this.page.locator(this.selectors.eventOrganizer)).toHaveText(expectedDetails.organizer);
|
|
await expect(this.page.locator(this.selectors.eventDescription)).toHaveText(expectedDetails.description);
|
|
}
|
|
|
|
// Ticket information verification methods
|
|
async verifyTicketInfo(expectedInfo: {
|
|
price: string;
|
|
quantity: string;
|
|
remaining: string;
|
|
}) {
|
|
await expect(this.page.locator(this.selectors.ticketPrice)).toHaveText(expectedInfo.price);
|
|
await expect(this.page.locator(this.selectors.ticketQuantity)).toHaveText(expectedInfo.quantity);
|
|
await expect(this.page.locator(this.selectors.ticketsRemaining)).toHaveText(expectedInfo.remaining);
|
|
}
|
|
|
|
// Transaction table verification methods
|
|
async verifyTransactionDetails(rowIndex: number, expectedTransaction: {
|
|
purchaserName: string;
|
|
organization: string;
|
|
purchaseDate: string;
|
|
ticketCount: string;
|
|
revenue: string;
|
|
}) {
|
|
const row = {
|
|
purchaserName: this.page.locator(this.selectors.purchaserNameLinks).nth(rowIndex),
|
|
organization: this.page.locator(this.selectors.organizationCells).nth(rowIndex),
|
|
purchaseDate: this.page.locator(this.selectors.purchaseDateCells).nth(rowIndex),
|
|
ticketCount: this.page.locator(this.selectors.ticketCountCells).nth(rowIndex),
|
|
revenue: this.page.locator(this.selectors.revenueCells).nth(rowIndex)
|
|
};
|
|
|
|
await expect(row.purchaserName).toHaveText(expectedTransaction.purchaserName);
|
|
await expect(row.organization).toHaveText(expectedTransaction.organization);
|
|
await expect(row.purchaseDate).toHaveText(expectedTransaction.purchaseDate);
|
|
await expect(row.ticketCount).toHaveText(expectedTransaction.ticketCount);
|
|
await expect(row.revenue).toHaveText(expectedTransaction.revenue);
|
|
}
|
|
|
|
async verifyPurchaserNameLink(rowIndex: number, expectedUrl: string) {
|
|
const link = this.page.locator(this.selectors.purchaserNameLinks).nth(rowIndex);
|
|
await expect(link).toHaveAttribute('href', expectedUrl);
|
|
}
|
|
|
|
// Summary statistics verification methods
|
|
async verifyTotalTicketsSold(expectedTotal: string) {
|
|
await expect(this.page.locator(this.selectors.totalTicketsSold)).toHaveText(expectedTotal);
|
|
}
|
|
|
|
async verifyTotalRevenue(expectedRevenue: string) {
|
|
await expect(this.page.locator(this.selectors.totalRevenue)).toHaveText(expectedRevenue);
|
|
}
|
|
|
|
// Table functionality methods
|
|
async verifyTransactionTableExists() {
|
|
await expect(this.page.locator(this.selectors.transactionsTable)).toBeVisible();
|
|
}
|
|
|
|
async getTransactionCount(): Promise<number> {
|
|
const rows = await this.page.locator(`${this.selectors.transactionsTable} tr`).count();
|
|
return rows - 1; // Subtract header row
|
|
}
|
|
} |