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

// TODO(P6-T1): these specs hard-code a literal [EXTENSION_ID] placeholder and can
// never pass. Skipped until a Playwright global-setup resolves the real extension
// ID from the loaded unpacked build's service-worker URL.
test.skip('LexAI popup opens correctly', async ({ page }) => {
  // Navigate to extension popup
  await page.goto('chrome-extension://[EXTENSION_ID]/popup/index.html');

  // Check LexAI branding is present
  await expect(page.locator('text=LexAI')).toBeVisible();

  // Check settings button is present
  await expect(page.locator('button:has-text("Open Settings")')).toBeVisible();
});

test.skip('Options page saves API key', async ({ page }) => {
  await page.goto('chrome-extension://[EXTENSION_ID]/options/index.html');

  // Fill in API key
  await page.fill('input[type="password"]', 'sk-test-key');

  // Select provider
  await page.selectOption('select:first-of-type', 'openai');

  // Save
  await page.click('button:has-text("Save Settings")');

  // Confirm saved
  await expect(page.locator('text=Saved!')).toBeVisible();
});
