generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcommand-palette.spec.ts
28 lines (21 loc) · 1.28 KB
/
command-palette.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { expect, test } from '@playwright/test'
import { pressShortcut } from './helpers'
test('shows command palette results', async ({ page }) => {
await page.goto('/')
await page.click('#command-palette-search')
await page.fill('#command-palette-search-input', 'echo')
// Command palette should be showing the echo parts
await expect(page.locator('[role="listbox"]').getByText('echo.EchoRequest', { exact: true })).toBeVisible()
await expect(page.locator('[role="listbox"]').getByText('echo.EchoResponse', { exact: true })).toBeVisible()
await expect(page.locator('[role="listbox"]').getByText('echo.echo', { exact: true })).toBeVisible()
})
test('opens command palette with keyboard shortcut', async ({ page }) => {
await page.goto('/')
await pressShortcut(page, 'k')
await expect(page.locator('#command-palette-search-input')).toBeVisible()
await page.fill('#command-palette-search-input', 'echo')
// Command palette should be showing the echo parts
await expect(page.locator('[role="listbox"]').getByText('echo.EchoRequest', { exact: true })).toBeVisible()
await expect(page.locator('[role="listbox"]').getByText('echo.EchoResponse', { exact: true })).toBeVisible()
await expect(page.locator('[role="listbox"]').getByText('echo.echo', { exact: true })).toBeVisible()
})