terminal-init.spec.ts 1.0 KB

12345678910111213141516171819202122232425262728
  1. import { test, expect } from "../fixtures"
  2. import { waitTerminalFocusIdle, waitTerminalReady } from "../actions"
  3. import { promptSelector, terminalSelector } from "../selectors"
  4. import { terminalToggleKey } from "../utils"
  5. test("smoke terminal mounts and can create a second tab", async ({ page, gotoSession }) => {
  6. await gotoSession()
  7. const terminals = page.locator(terminalSelector)
  8. const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
  9. const opened = await terminals.first().isVisible()
  10. if (!opened) {
  11. await page.keyboard.press(terminalToggleKey)
  12. }
  13. await waitTerminalFocusIdle(page, { term: terminals.first() })
  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 waitTerminalReady(page, { term: terminals.first() })
  22. })