terminal-init.spec.ts 933 B

1234567891011121314151617181920212223242526
  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 opened = await terminals.first().isVisible()
  8. if (!opened) {
  9. await page.keyboard.press(terminalToggleKey)
  10. }
  11. await expect(terminals.first()).toBeVisible()
  12. await expect(terminals.first().locator("textarea")).toHaveCount(1)
  13. await expect(terminals).toHaveCount(1)
  14. // Ghostty captures a lot of keybinds when focused; move focus back
  15. // to the app shell before triggering `terminal.new`.
  16. await page.locator(promptSelector).click()
  17. await page.keyboard.press("Control+Alt+T")
  18. await expect(terminals).toHaveCount(2)
  19. await expect(terminals.nth(1).locator("textarea")).toHaveCount(1)
  20. })