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

62 lines
No EOL
2.8 KiB
TypeScript

import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';
import { test } from '@playwright/test';
import { VerbosityController } from '../e2e/utils/VerbosityController';
test.describe('Debug Event Submit', () => {
test('Check event submit button', async ({ page }) => {
const verbose = new VerbosityController();
// 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'));
// Go to create event
await page.goto('https://upskill-staging.measurequick.com/community/add/');
await page.waitForLoadState('networkidle');
// Fill basic event data
await page.fill('input[name="post_title"]', 'Test Event Submit');
// Check for submit buttons
const submitButtons = await page.$$eval('input[type="submit"], button[type="submit"]', elements => {
return elements.map(el => ({
tagName: el.tagName,
name: el.getAttribute('name'),
value: el.getAttribute('value'),
text: (el as HTMLElement).innerText,
id: el.id,
className: el.className,
visible: (el as HTMLElement).offsetParent !== null
}));
});
console.log('Submit buttons found:', JSON.stringify(submitButtons, null, 2));
// Also check for save/publish buttons
const allButtons = await page.$$eval('input[type="submit"], button, a[href*="save"], a[href*="publish"], input[value*="Save"], input[value*="Publish"], input[value*="Submit"], button:has-text("Save"), button:has-text("Publish"), button:has-text("Submit")', elements => {
return elements.map(el => ({
tagName: el.tagName,
type: el.getAttribute('type'),
name: el.getAttribute('name'),
value: el.getAttribute('value'),
text: (el as HTMLElement).innerText,
id: el.id,
className: el.className,
href: el.getAttribute('href'),
visible: (el as HTMLElement).offsetParent !== null
}));
});
console.log('All potential save/submit buttons:', JSON.stringify(allButtons, null, 2));
// Take screenshot
await page.screenshot({ path: 'test-results/screenshots/debug-submit-buttons.png', fullPage: true });
});
});