91 lines
No EOL
3.8 KiB
TypeScript
91 lines
No EOL
3.8 KiB
TypeScript
import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
// STAGING_URL is now imported from config
|
|
|
|
test('Debug Event Submission - Final', async ({ page }) => {
|
|
// Login
|
|
await page.goto(PATHS.login);
|
|
await page.fill('#user_login', 'test_trainer');
|
|
await page.fill('#user_pass', 'Test123!');
|
|
await page.click('#wp-submit');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Navigate to add event
|
|
await page.goto(`${STAGING_URL}/community-dashboard/`);
|
|
await page.click('a:has-text("ADD YOUR EVENT")');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
// Fill all required fields
|
|
await page.fill('#post_title', 'Test Event for Submission');
|
|
|
|
// Fill description (TinyMCE)
|
|
try {
|
|
const frame = page.frameLocator('iframe[id$="_ifr"]');
|
|
await frame.locator('body').fill('This is a test event description.');
|
|
} catch (e) {
|
|
await page.fill('#tcepostcontent', 'This is a test event description.');
|
|
}
|
|
|
|
// Fill dates and times
|
|
await page.fill('input[name="EventStartDate"]', '01/25/2025');
|
|
await page.fill('input[name="EventStartTime"]', '10:00 AM');
|
|
await page.fill('input[name="EventEndDate"]', '01/25/2025');
|
|
await page.fill('input[name="EventEndTime"]', '12:00 PM');
|
|
|
|
// Select venue and organizer (choose "Use New...")
|
|
await page.selectOption('select#saved_tribe_venue', '-1');
|
|
await page.selectOption('select#saved_tribe_organizer', '-1');
|
|
|
|
// Fill venue details if required
|
|
const venueNameField = await page.locator('input[name="Venue[Venue]"]');
|
|
if (await venueNameField.isVisible()) {
|
|
await venueNameField.fill('Test Venue');
|
|
await page.fill('input[name="Venue[City]"]', 'Austin');
|
|
await page.fill('input[name="Venue[State]"]', 'TX');
|
|
await page.fill('input[name="Venue[Zip]"]', '78701');
|
|
}
|
|
|
|
// Fill organizer details if required
|
|
const organizerNameField = await page.locator('input[name="Organizer[Organizer]"]');
|
|
if (await organizerNameField.isVisible()) {
|
|
await organizerNameField.fill('Test Organizer');
|
|
await page.fill('input[name="Organizer[Email]"]', 'test@example.com');
|
|
await page.fill('input[name="Organizer[Phone]"]', '555-1234');
|
|
}
|
|
|
|
// Screenshot before submission
|
|
await page.screenshot({ path: 'test-results/screenshots/before-submit.png' });
|
|
|
|
// Submit the form
|
|
await page.click('input[name="community-event"][value="Submit Event"]');
|
|
|
|
// Wait for navigation/response
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(3000);
|
|
|
|
// Screenshot after submission
|
|
await page.screenshot({ path: 'test-results/screenshots/after-submit.png' });
|
|
|
|
// Check URL and content
|
|
const currentUrl = page.url();
|
|
console.log('Current URL:', currentUrl);
|
|
|
|
// Check for success messages
|
|
const viewYourEventsButton = await page.locator('text="VIEW YOUR SUBMITTED EVENTS"').isVisible().catch(() => false);
|
|
const myEventsLink = await page.locator('a[href*="/my-events/"]').isVisible().catch(() => false);
|
|
const successMessage = await page.locator('.tribe-success-msg').isVisible().catch(() => false);
|
|
|
|
console.log('View Your Events Button:', viewYourEventsButton);
|
|
console.log('My Events Link:', myEventsLink);
|
|
console.log('Success Message:', successMessage);
|
|
|
|
// Check if we're now on My Events or event detail page
|
|
const onMyEvents = currentUrl.includes('/my-events/');
|
|
const onEventDetail = currentUrl.includes('/event/');
|
|
|
|
console.log('On My Events:', onMyEvents);
|
|
console.log('On Event Detail:', onEventDetail);
|
|
|
|
expect(viewYourEventsButton || myEventsLink || successMessage || onMyEvents || onEventDetail).toBeTruthy();
|
|
}); |