terminal-init.spec.ts 1.0 KB

12345678910111213141516171819202122232425262728
  1. import { test, expect } from "../fixtures"
  2. import { promptSelector, terminalSelector } from "../selectors"
  3. import { terminalToggleKey } from "../utils"
  4. test("smoke terminal mounts and can create a second tab", async ({ page, gotoSession }) => {
  5. await gotoSession()
  6. const terminals = page.locator(terminalSelector)
  7. const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
  8. const opened = await terminals.first().isVisible()
  9. if (!opened) {
  10. await page.keyboard.press(terminalToggleKey)
  11. }
  12. await expect(terminals.first()).toBeVisible()
  13. await expect(terminals.first().locator("textarea")).toHaveCount(1)
  14. await expect(terminals).toHaveCount(1)
  15. // Ghostty captures a lot of keybinds when focused; move focus back
  16. // to the app shell before triggering `terminal.new`.
  17. await page.locator(promptSelector).click()
  18. await page.keyboard.press("Control+Alt+T")
  19. await expect(tabs).toHaveCount(2)
  20. await expect(terminals).toHaveCount(1)
  21. await expect(terminals.first().locator("textarea")).toHaveCount(1)
  22. })