terminal-init.spec.ts 901 B

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