- Update docs/mvp-integration-testing-plan.md, docs/REQUIREMENTS.md, wordpress-dev/README.md, and memory-bank/playwright-test-plan.md with correct Playwright test execution commands - Replace outdated references to ./tests/run-tests.sh pw with wordpress-dev/bin/run-tests.sh --e2e - Document that test_trainer user is missing on staging environment, causing E2E test failures - Note absence of automated test user setup script despite documentation references The Playwright E2E tests are failing because the required test user (test_trainer) does not exist on the staging environment. When attempting to log in via the custom community login page, the browser is redirected to the standard WordPress login page instead of the dashboard. This commit does not include the actual creation of the test user or the development of an automated setup script, which are planned as follow-up tasks. Resolves: #MVP-123 (Integration test debugging)
146 lines
No EOL
5.3 KiB
TypeScript
146 lines
No EOL
5.3 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { EventSummaryPage } from '../../pages/EventSummaryPage';
|
|
import { DashboardPage } from '../../pages/DashboardPage';
|
|
import { LogParser } from '../../utils/logParser';
|
|
import '../../utils/testHelpers';
|
|
|
|
test.describe('Event Summary Page', () => {
|
|
let eventSummaryPage: EventSummaryPage;
|
|
let dashboardPage: DashboardPage;
|
|
let logParser: LogParser;
|
|
const testEventId = '12345'; // Replace with actual test event ID
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
eventSummaryPage = new EventSummaryPage(page);
|
|
dashboardPage = new DashboardPage(page);
|
|
logParser = new LogParser();
|
|
|
|
// Navigate to event summary page
|
|
await eventSummaryPage.navigate(testEventId);
|
|
});
|
|
|
|
test('should display correct event details', async () => {
|
|
const expectedDetails = {
|
|
title: 'HVAC Training Workshop',
|
|
dateTime: 'May 1, 2025 14:00',
|
|
location: 'Training Center A',
|
|
organizer: 'John Smith',
|
|
description: 'Comprehensive HVAC training session'
|
|
};
|
|
|
|
await eventSummaryPage.verifyEventDetails(expectedDetails);
|
|
});
|
|
|
|
test('should display correct ticket information', async () => {
|
|
const expectedTicketInfo = {
|
|
price: '$50.00',
|
|
quantity: '100',
|
|
remaining: '75'
|
|
};
|
|
|
|
await eventSummaryPage.verifyTicketInfo(expectedTicketInfo);
|
|
});
|
|
|
|
test('should display and validate transactions table', async () => {
|
|
await eventSummaryPage.verifyTransactionTableExists();
|
|
|
|
// Verify first transaction details
|
|
const expectedTransaction = {
|
|
purchaserName: 'Alice Johnson',
|
|
organization: 'HVAC Corp',
|
|
purchaseDate: '2025-04-10 09:30',
|
|
ticketCount: '2',
|
|
revenue: '$100.00'
|
|
};
|
|
|
|
await eventSummaryPage.verifyTransactionDetails(0, expectedTransaction);
|
|
|
|
// Verify purchaser name link
|
|
await eventSummaryPage.verifyPurchaserNameLink(0, '/purchaser/alice-johnson');
|
|
});
|
|
|
|
test('should calculate and display correct summary statistics', async () => {
|
|
// Assuming multiple transactions in the table
|
|
await eventSummaryPage.verifyTotalTicketsSold('25');
|
|
await eventSummaryPage.verifyTotalRevenue('$1,250.00');
|
|
});
|
|
|
|
test('should navigate to edit event page', async () => {
|
|
await eventSummaryPage.clickEditEvent();
|
|
await expect(eventSummaryPage.page).toHaveURL(/.*community-events-edit/);
|
|
});
|
|
|
|
test('should return to dashboard when clicking return button', async () => {
|
|
await eventSummaryPage.returnToDashboard();
|
|
await expect(dashboardPage.page).toHaveURL(/.*hvac-dashboard/);
|
|
});
|
|
|
|
test('should verify all transaction table functionality', async () => {
|
|
// Verify multiple transactions
|
|
const transactions = [
|
|
{
|
|
purchaserName: 'Alice Johnson',
|
|
organization: 'HVAC Corp',
|
|
purchaseDate: '2025-04-10 09:30',
|
|
ticketCount: '2',
|
|
revenue: '$100.00'
|
|
},
|
|
{
|
|
purchaserName: 'Bob Smith',
|
|
organization: 'Cool Tech',
|
|
purchaseDate: '2025-04-10 10:15',
|
|
ticketCount: '3',
|
|
revenue: '$150.00'
|
|
},
|
|
{
|
|
purchaserName: 'Carol White',
|
|
organization: 'Air Systems',
|
|
purchaseDate: '2025-04-10 11:00',
|
|
ticketCount: '1',
|
|
revenue: '$50.00'
|
|
}
|
|
];
|
|
|
|
// Verify each transaction in the table
|
|
for (let i = 0; i < transactions.length; i++) {
|
|
await eventSummaryPage.verifyTransactionDetails(i, transactions[i]);
|
|
await eventSummaryPage.verifyPurchaserNameLink(i, `/purchaser/${transactions[i].purchaserName.toLowerCase().replace(' ', '-')}`);
|
|
}
|
|
|
|
// Verify total number of transactions
|
|
const transactionCount = await eventSummaryPage.getTransactionCount();
|
|
expect(transactionCount).toBe(transactions.length);
|
|
});
|
|
|
|
test('should verify time and date display format', async () => {
|
|
const expectedDetails = {
|
|
title: 'HVAC Training Workshop',
|
|
dateTime: 'May 1, 2025 14:00', // Verify specific format
|
|
location: 'Training Center A',
|
|
organizer: 'John Smith',
|
|
description: 'Comprehensive HVAC training session'
|
|
};
|
|
|
|
await eventSummaryPage.verifyEventDetails(expectedDetails);
|
|
});
|
|
|
|
test('should verify revenue calculations accuracy', async () => {
|
|
// Get all transactions and verify total revenue calculation
|
|
const transactions = [
|
|
{ ticketCount: '2', revenue: '$100.00' },
|
|
{ ticketCount: '3', revenue: '$150.00' },
|
|
{ ticketCount: '1', revenue: '$50.00' }
|
|
];
|
|
|
|
let totalTickets = 0;
|
|
let totalRevenue = 0;
|
|
|
|
for (const transaction of transactions) {
|
|
totalTickets += parseInt(transaction.ticketCount);
|
|
totalRevenue += parseFloat(transaction.revenue.replace('$', ''));
|
|
}
|
|
|
|
await eventSummaryPage.verifyTotalTicketsSold(totalTickets.toString());
|
|
await eventSummaryPage.verifyTotalRevenue(`$${totalRevenue.toFixed(2)}`);
|
|
});
|
|
}); |