settings.test.ts 1.8 KB

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