import { test, expect } from '@playwright/test'

test('opens the global search from the home view', async ({ page }) => {
  await page.goto('/')
  await expect(page.getByRole('heading', { level: 1 })).toContainText('掌控你的网页书签')

  await page.getByRole('button', { name: /打开搜索/ }).click()

  const modal = page.getByRole('dialog', { name: /全局书签搜索/ })
  await expect(modal).toBeVisible()

  await page.keyboard.press('Escape')
  await expect(modal).toBeHidden()
})
