Skip to content

The open source coding agent.

TypeScript
1.0 KB
Raw Blame
import { test, expect } from "../fixtures"
import { waitTerminalFocusIdle, waitTerminalReady } from "../actions"
import { promptSelector, terminalSelector } from "../selectors"
import { terminalToggleKey } from "../utils"

test("smoke terminal mounts and can create a second tab", async ({ page, gotoSession }) => {
  await gotoSession()

  const terminals = page.locator(terminalSelector)
  const tabs = page.locator('#terminal-panel [data-slot="tabs-trigger"]')
  const opened = await terminals.first().isVisible()

  if (!opened) {
    await page.keyboard.press(terminalToggleKey)
  }

  await waitTerminalFocusIdle(page, { term: terminals.first() })
  await expect(terminals).toHaveCount(1)

  // Ghostty captures a lot of keybinds when focused; move focus back
  // to the app shell before triggering `terminal.new`.
  await page.locator(promptSelector).click()
  await page.keyboard.press("Control+Alt+T")

  await expect(tabs).toHaveCount(2)
  await expect(terminals).toHaveCount(1)
  await waitTerminalReady(page, { term: terminals.first() })
})