MCPcopy
hub / github.com/callumalpass/tasknotes / runCommand

Function runCommand

e2e/obsidian.ts:431–447  ·  view source on GitHub ↗
(page: Page, command: string)

Source from the content-addressed store, hash-verified

429}
430
431export async function runCommand(page: Page, command: string): Promise<void> {
432 await openCommandPalette(page);
433 // Type the command
434 await page.keyboard.type(command, { delay: 30 });
435 await page.waitForTimeout(500); // Wait for search to filter
436
437 // Wait for suggestions to appear
438 const suggestion = page.locator('.suggestion-item').first();
439 try {
440 await suggestion.waitFor({ timeout: 3000, state: 'visible' });
441 await page.keyboard.press('Enter');
442 } catch {
443 // If no suggestions found, still try to press Enter and close palette
444 await page.keyboard.press('Escape');
445 throw new Error(`Command not found: "${command}". Make sure TaskNotes plugin is loaded.`);
446 }
447}
448
449export async function waitForNotice(page: Page, text?: string): Promise<void> {
450 const notice = page.locator('.notice');

Calls 1

openCommandPaletteFunction · 0.85

Tested by 5

openViewFunction · 0.72
reloadWithoutSavingFunction · 0.72
moveToPopoutWindowFunction · 0.72
moveToPopoutWindowFunction · 0.72