upskill-event-manager/wordpress-dev/tests/e2e/debug-find-events.test.ts

67 lines
No EOL
3 KiB
TypeScript

import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';
import { test } from '@playwright/test';
test.describe('Debug Find Events', () => {
test('Look for events in all filters', async ({ page }) => {
page.setDefaultTimeout(60000);
// Navigate directly to community-login
const loginUrl = 'https://upskill-staging.measurequick.com/community-login/';
await page.goto(loginUrl);
await page.waitForLoadState('networkidle');
// Login
await page.fill('#user_login', 'test_trainer');
await page.fill('#user_pass', 'Test123!');
await page.click('#wp-submit');
await page.waitForURL((url) => !url.toString().includes('community-login'));
// We should be on dashboard
console.log('Dashboard URL:', page.url());
// Check stats
const totalEvents = await page.locator('.stat-value').first().textContent();
console.log('Total Events in stats:', totalEvents);
// Check if events table is visible
const tableVisible = await page.locator('.events-list').isVisible();
console.log('Events table visible:', tableVisible);
// Click on different filter tabs
const filters = ['ALL', 'PUBLISH', 'DRAFT', 'PENDING', 'PRIVATE'];
for (const filter of filters) {
try {
await page.click(`button:has-text("${filter}")`);
await page.waitForTimeout(1000);
// Check rows in the table
const rows = await page.locator('.events-list tbody tr').count();
console.log(`${filter} filter - Rows found:`, rows);
// Check if there's a "No events found" message
const noEventsMessage = await page.locator('.events-list tbody tr td:has-text("No events found")').count();
console.log(`${filter} filter - No events message:`, noEventsMessage > 0);
// If rows > 0 and not "No events found", list event details
if (rows > 0 && noEventsMessage === 0) {
for (let i = 0; i < rows; i++) {
const eventName = await page.locator(`.events-list tbody tr:nth-child(${i + 1}) td:nth-child(2)`).textContent();
const eventStatus = await page.locator(`.events-list tbody tr:nth-child(${i + 1}) td:nth-child(1)`).textContent();
console.log(`Event ${i + 1}: ${eventName} (Status: ${eventStatus})`);
}
}
} catch (e) {
console.log(`Error clicking ${filter} filter:`, e.message);
}
}
// Check MY EVENTS page too
await page.click('a:has-text("MY EVENTS")');
await page.waitForLoadState('networkidle');
console.log('MY EVENTS URL:', page.url());
// Take screenshot
await page.screenshot({ path: 'test-results/screenshots/my-events-page.png', fullPage: true });
});
});