import { test, expect } from '@playwright/test';

test.describe('Production Site Tests', () => {
  test('should load production homepage', async ({ page }) => {
    console.log('Testing: https://vip.madeamess.online');
    
    await page.goto('https://vip.madeamess.online', {
      waitUntil: 'networkidle',
      timeout: 30000
    });

    // Check title
    await expect(page).toHaveTitle(/VIP Coordinator/i);
    console.log('✅ Page title correct');

    // Take screenshot
    await page.screenshot({ path: 'production-screenshot.png', fullPage: true });
    console.log('✅ Screenshot saved');
  });

  test('should have working API', async ({ request }) => {
    const response = await request.get('https://vip.madeamess.online/api/v1/health');
    expect(response.ok()).toBeTruthy();
    
    const data = await response.json();
    expect(data.status).toBe('ok');
    expect(data.environment).toBe('production');
    console.log('✅ API health check passed:', data);
  });

  test('should load without errors', async ({ page }) => {
    await page.goto('https://vip.madeamess.online');
    
    // Wait for React to render
    await page.waitForLoadState('networkidle');
    
    console.log('✅ Page loaded successfully');
  });
});
