From 922a6868b511641f443e4496fdaeb814f208719d Mon Sep 17 00:00:00 2001 From: jonghoonpark Date: Tue, 12 Mar 2024 22:45:05 +0900 Subject: [PATCH] change 'run test' shortcut to 'enter with shift' --- packages/trace-viewer/src/ui/uiModeView.tsx | 2 +- .../playwright-test/ui-mode-test-shortcut.spec.ts | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/trace-viewer/src/ui/uiModeView.tsx b/packages/trace-viewer/src/ui/uiModeView.tsx index d3a2e3889b..2a4a81a50d 100644 --- a/packages/trace-viewer/src/ui/uiModeView.tsx +++ b/packages/trace-viewer/src/ui/uiModeView.tsx @@ -179,7 +179,7 @@ export const UIModeView: React.FC<{}> = ({ React.useEffect(() => { const onShortcutEvent = (e: KeyboardEvent) => { - if (e.code === 'KeyR' && (e.metaKey || e.ctrlKey)){ + if (e.key === 'Enter' && e.shiftKey) { e.preventDefault(); runTests('bounce-if-busy', visibleTestIds); } else if (e.code === 'KeyS' && (e.metaKey || e.ctrlKey)) { diff --git a/tests/playwright-test/ui-mode-test-shortcut.spec.ts b/tests/playwright-test/ui-mode-test-shortcut.spec.ts index 15d763b6d9..3c7910f330 100644 --- a/tests/playwright-test/ui-mode-test-shortcut.spec.ts +++ b/tests/playwright-test/ui-mode-test-shortcut.spec.ts @@ -28,24 +28,13 @@ const basicTestTree = { ` }; -test('should run on Meta(command) with R', async ({ runUITest }) => { +test('should run on Enter with Shift', async ({ runUITest }) => { const { page } = await runUITest(basicTestTree); await expect(page.getByTitle('Run all')).toBeEnabled(); await expect(page.getByTitle('Stop')).toBeDisabled(); - await page.keyboard.press('Meta+r'); - - await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)'); -}); - -test('should run on Control with R', async ({ runUITest }) => { - const { page } = await runUITest(basicTestTree); - - await expect(page.getByTitle('Run all')).toBeEnabled(); - await expect(page.getByTitle('Stop')).toBeDisabled(); - - await page.keyboard.press('Control+r'); + await page.keyboard.press('Enter+Shift'); await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)'); });