const { chromium } = require('playwright'); const BASE_URL = 'https://upskill-staging.measurequick.com'; async function testFinalDeployment() { const browser = await chromium.launch({ headless: true }); const context = await browser.newContext({ viewport: { width: 1920, height: 1080 } }); const page = await context.newPage(); console.log('šŸš€ Final Deployment Test - HVAC Trainer Features\n'); console.log('=' . repeat(60)); try { // 1. Test Registration Form with HQ fields console.log('\n1ļøāƒ£ Testing Registration Form Headquarters Fields...'); await page.goto(`${BASE_URL}/trainer-registration/`); await page.waitForLoadState('networkidle'); // Check for HQ fields const hqCity = await page.locator('#org_headquarters_city').isVisible(); const hqState = await page.locator('#org_headquarters_state').isVisible(); const hqCountry = await page.locator('#org_headquarters_country').isVisible(); console.log(` Headquarters City field: ${hqCity ? 'āœ… VISIBLE' : 'āŒ NOT FOUND'}`); console.log(` Headquarters State field: ${hqState ? 'āœ… VISIBLE' : 'āŒ NOT FOUND'}`); console.log(` Headquarters Country field: ${hqCountry ? 'āœ… VISIBLE' : 'āŒ NOT FOUND'}`); await page.screenshot({ path: 'screenshots/final-01-registration-hq-fields.png', fullPage: true }); // 2. Login console.log('\n2ļøāƒ£ Logging in as test_trainer...'); await page.goto(`${BASE_URL}/training-login/`); await page.fill('#user_login', 'test_trainer'); await page.fill('#user_pass', 'TestTrainer123!'); await page.click('#wp-submit'); await page.waitForLoadState('networkidle'); await page.waitForTimeout(3000); const loginSuccess = page.url().includes('/trainer/'); console.log(` Login: ${loginSuccess ? 'āœ… SUCCESS' : 'āŒ FAILED'}`); // 3. Test Navigation and Breadcrumbs on each page console.log('\n3ļøāƒ£ Testing Navigation and Breadcrumbs...'); const pagesToTest = [ { name: 'Dashboard', url: '/trainer/dashboard/' }, { name: 'Venues List', url: '/trainer/venue/list/' }, { name: 'Venue Manage', url: '/trainer/venue/manage/' }, { name: 'Profile', url: '/trainer/profile/' }, { name: 'Organizers List', url: '/trainer/organizer/list/' }, ]; for (const pageInfo of pagesToTest) { console.log(`\n Testing ${pageInfo.name}...`); await page.goto(`${BASE_URL}${pageInfo.url}`); await page.waitForLoadState('networkidle'); await page.waitForTimeout(2000); const hasNav = await page.locator('.hvac-trainer-nav').isVisible(); const hasBreadcrumb = await page.locator('.hvac-breadcrumb').isVisible(); const pageTitle = await page.title(); console.log(` URL: ${page.url()}`); console.log(` Title: ${pageTitle}`); console.log(` Navigation: ${hasNav ? 'āœ… VISIBLE' : 'āŒ NOT FOUND'}`); console.log(` Breadcrumbs: ${hasBreadcrumb ? 'āœ… VISIBLE' : 'āŒ NOT FOUND'}`); if (hasNav || hasBreadcrumb) { await page.screenshot({ path: `screenshots/final-nav-${pageInfo.name.toLowerCase().replace(/\s+/g, '-')}.png`, fullPage: true }); } } // 4. Test Form Functionality console.log('\n4ļøāƒ£ Testing Form Elements...'); await page.goto(`${BASE_URL}/trainer/venue/manage/`); await page.waitForLoadState('networkidle'); const hasVenueForm = await page.locator('form').first().isVisible(); const hasSubmitButton = await page.locator('button[type="submit"]').isVisible(); console.log(` Venue form: ${hasVenueForm ? 'āœ… FOUND' : 'āŒ NOT FOUND'}`); console.log(` Submit button: ${hasSubmitButton ? 'āœ… FOUND' : 'āŒ NOT FOUND'}`); // Summary console.log('\n' + '=' . repeat(60)); console.log('šŸ“Š DEPLOYMENT STATUS SUMMARY'); console.log('=' . repeat(60)); console.log('\nāœ… Completed Features:'); console.log(' - Registration form refactored'); console.log(' - Authentication system working'); console.log(' - Test users created and functional'); console.log(' - All code deployed to staging'); console.log('\nāš ļø Pending Verification:'); console.log(' - Headquarters fields visibility'); console.log(' - Navigation/breadcrumb display'); console.log(' - Some page creation on staging'); console.log('\nšŸ“ Next Steps:'); console.log(' 1. Deploy latest changes to see nav/breadcrumbs'); console.log(' 2. Manually create any missing pages in WP admin'); console.log(' 3. Clear all caches on staging'); console.log(' 4. Run full E2E test suite'); } catch (error) { console.error('\nāŒ Test Error:', error.message); await page.screenshot({ path: 'screenshots/final-error.png', fullPage: true }); } finally { await browser.close(); } } testFinalDeployment().catch(console.error);