change 'run test' shortcut to 'Ctrl/Cmd + Enter'
This commit is contained in:
parent
922a6868b5
commit
bf9fc9ce9c
|
|
@ -179,7 +179,7 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const onShortcutEvent = (e: KeyboardEvent) => {
|
const onShortcutEvent = (e: KeyboardEvent) => {
|
||||||
if (e.key === 'Enter' && e.shiftKey) {
|
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
runTests('bounce-if-busy', visibleTestIds);
|
runTests('bounce-if-busy', visibleTestIds);
|
||||||
} else if (e.code === 'KeyS' && (e.metaKey || e.ctrlKey)) {
|
} else if (e.code === 'KeyS' && (e.metaKey || e.ctrlKey)) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
const { page } = await runUITest(basicTestTree);
|
||||||
|
|
||||||
await expect(page.getByTitle('Run all')).toBeEnabled();
|
await expect(page.getByTitle('Run all')).toBeEnabled();
|
||||||
await expect(page.getByTitle('Stop')).toBeDisabled();
|
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%)');
|
await expect(page.getByTestId('status-line')).toHaveText('Running 1/4 passed (25%)');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue