mirror of
https://github.com/documenso/documenso.git
synced 2026-07-22 16:03:39 +10:00
19 lines
682 B
TypeScript
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 });
|
|
};
|