settings.test.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { test, expect, type TestFixtures } from "./playwright-base-test"
  2. import { findWebview, upsertApiConfiguration, verifyExtensionInstalled, clickSaveSettingsButton } from "../helpers"
  3. test.describe("Settings", () => {
  4. test("screenshots", async ({ workbox: page, takeScreenshot }: TestFixtures) => {
  5. await verifyExtensionInstalled(page)
  6. await upsertApiConfiguration(page)
  7. // Open the settings then move the mouse to avoid triggering the tooltip
  8. const webviewFrame = await findWebview(page)
  9. page.locator('[aria-label*="Settings"], [title*="Settings"]').first().click()
  10. await clickSaveSettingsButton(webviewFrame)
  11. await expect(webviewFrame.locator('[role="tablist"]')).toBeVisible({ timeout: 10000 })
  12. console.log("✅ Settings view loaded")
  13. await expect(webviewFrame.locator('[data-testid="settings-tab-list"]')).toBeVisible()
  14. console.log("✅ Settings tab list visible")
  15. const tabButtons = webviewFrame.locator('[role="tab"]')
  16. const tabCount = await tabButtons.count()
  17. console.log(`✅ Found ${tabCount} settings tabs`)
  18. // Take screenshot of each tab (except for the last two)
  19. // MCP settings page is flakey and the info page has the version which changes
  20. for (let i = 0; i < tabCount - 2; i++) {
  21. const tabButton = tabButtons.nth(i)
  22. await tabButton.click()
  23. await page.waitForTimeout(500)
  24. const tabText = await tabButton.textContent()
  25. const tabName = tabText?.trim() || `tab-${i}`
  26. const testId = await tabButton.getAttribute("data-testid")
  27. const sectionId = testId?.replace("tab-", "") || `section-${i}`
  28. await clickSaveSettingsButton(webviewFrame) // To avoid flakey screenshots
  29. await takeScreenshot(`${i}-settings-${sectionId}-${tabName.toLowerCase().replace(/\s+/g, "-")}`)
  30. }
  31. console.log("✅ All settings tabs screenshots completed")
  32. })
  33. })