change 'run test' shortcut to 'Ctrl/Cmd + Enter'

This commit is contained in:
jonghoonpark 2024-03-12 23:28:04 +09:00
parent 922a6868b5
commit bf9fc9ce9c
2 changed files with 14 additions and 3 deletions

View file

@ -179,7 +179,7 @@ export const UIModeView: React.FC<{}> = ({
React.useEffect(() => {
const onShortcutEvent = (e: KeyboardEvent) => {
if (e.key === 'Enter' && e.shiftKey) {
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
runTests('bounce-if-busy', visibleTestIds);
} else if (e.code === 'KeyS' && (e.metaKey || e.ctrlKey)) {

View file

@ -28,13 +28,24 @@ const basicTestTree = {
`
};
test('should run on Enter with Shift', async ({ runUITest }) => {
test('should run on Meta(command) with Enter', async ({ runUITest }) => {
const { page } = await runUITest(basicTestTree);
await expect(page.getByTitle('Run all')).toBeEnabled();
await expect(page.getByTitle('Stop')).toBeDisabled();
await page.keyboard.press('Enter+Shift');
await page.keyboard.press('Meta+Enter');
await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)');
});
test('should run on Control with Enter', 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+Enter');
await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)');
});