Files
documenso/packages/app-tests/e2e/fixtures/command-menu.ts
T
2026-07-18 12:32:27 +09:00

19 lines
682 B
TypeScript

import type { Page } from '@playwright/test';
import { expect } from '@playwright/test';
/**
* Opens the app command menu via the keyboard shortcut.
*
* Retries the shortcut until the menu appears since the keypress is a no-op
* when it happens before the page has hydrated.
*
* @param placeholder The search input placeholder to wait for, which differs
* between admin and non-admin users.
*/
export const openCommandMenu = async (page: Page, placeholder: string) => {
await expect(async () => {
await page.keyboard.press('Meta+K');
await expect(page.getByPlaceholder(placeholder).first()).toBeVisible({ timeout: 1_000 });
}).toPass({ timeout: 15_000 });
};