upskill-event-manager/wordpress-dev/tests/e2e/debug-create-link-simple.test.ts

45 lines
No EOL
2.1 KiB
TypeScript

import { STAGING_URL, PATHS, TIMEOUTS } from './config/staging-config';
import { test } from '@playwright/test';
test.describe('Debug Create Event Link Simple', () => {
test('Find create event button URL', async ({ page }) => {
// 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'));
// Wait a bit and then take screenshot
await page.waitForTimeout(2000);
await page.screenshot({ path: 'test-results/screenshots/dashboard-after-login.png', fullPage: true });
// Try to find any button/link with "CREATE" or "EVENT" text
const allLinks = await page.$$eval('a, button', elements => {
return elements.map(el => ({
tagName: el.tagName,
text: (el as HTMLElement).innerText || '',
href: el.getAttribute('href') || '',
className: el.className || '',
id: el.id || '',
visible: (el as HTMLElement).offsetParent !== null
})).filter(el => el.text.toLowerCase().includes('create') || el.text.toLowerCase().includes('event'));
});
console.log('Buttons/Links with CREATE or EVENT:', JSON.stringify(allLinks, null, 2));
// Try clicking CREATE EVENT button
try {
await page.click('a:has-text("CREATE EVENT")');
await page.waitForLoadState('networkidle');
console.log('Clicked CREATE EVENT, navigated to:', page.url());
await page.screenshot({ path: 'test-results/screenshots/create-event-page-new.png', fullPage: true });
} catch (e) {
console.log('Could not click CREATE EVENT button:', e.message);
}
});
});