const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const context = await browser.newContext({
    userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36'
  });
  const page = await context.newPage();
  
  // Login
  await page.goto('https://openweb.kangaroo-eel.ts.net/auth');
  await page.waitForTimeout(2000);
  await page.fill('input[type="email"]', 'anthonymau@gmail.com');
  await page.fill('input[type="password"]', 'RecOvery2026!');
  await page.click('button[type="submit"]');
  await page.waitForTimeout(5000);
  
  // Go to settings
  await page.goto('https://openweb.kangaroo-eel.ts.net/');
  await page.waitForTimeout(2000);
  
  // Click user menu
  await page.click('button:has-text("User menu")');
  await page.waitForTimeout(1000);
  
  // Click Settings
  await page.click('text=Settings');
  await page.waitForTimeout(3000);
  
  // Click Personalization tab
  await page.click('text=Personalization');
  await page.waitForTimeout(3000);
  
  console.log('📍 URL:', page.url());
  
  const text = await page.evaluate(() => document.body.innerText);
  console.log('\n📝 Personalization content:');
  console.log(text);
  
  // Screenshot
  await page.screenshot({ path: '/tmp/personalization.png', fullPage: true });
  
  await browser.close();
})();
