Added alt+r for running tests

This commit is contained in:
tommy-mode 2024-09-30 11:45:37 -04:00
parent c67a7335ab
commit ffaa08e607
2 changed files with 18 additions and 11 deletions

View file

@ -362,7 +362,7 @@ export const UIModeView: React.FC<{}> = ({
} else if (e.code === 'F5' && e.shiftKey) { } else if (e.code === 'F5' && e.shiftKey) {
e.preventDefault(); e.preventDefault();
testServerConnection?.stopTestsNoReply({}); testServerConnection?.stopTestsNoReply({});
} else if (e.code === 'F5') { } else if ((e.code === 'F5') || (e.code === 'KeyR' && e.altKey)) {
e.preventDefault(); e.preventDefault();
runTests('bounce-if-busy', visibleTestIds); runTests('bounce-if-busy', visibleTestIds);
} }

View file

@ -28,17 +28,22 @@ const basicTestTree = {
` `
}; };
test('should run tests', async ({ runUITest }) => { ["F5", "Alt+r"].forEach((keyboardShortcut) => {
test.only(`should run tests with "${keyboardShortcut}"`, 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.getByPlaceholder('Filter (e.g. text, @tag)').fill('test 3'); await page.getByPlaceholder("Filter (e.g. text, @tag)").fill("test 3");
await page.keyboard.press('F5'); await page.keyboard.press(keyboardShortcut);
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)'); await expect(page.getByTestId("status-line")).toHaveText(
await page.getByPlaceholder('Filter (e.g. text, @tag)').fill(''); "1/1 passed (100%)",
);
await page.getByPlaceholder("Filter (e.g. text, @tag)").fill("");
// Only the filtered test was run. // Only the filtered test was run.
await expect.poll(dumpTestTree(page)).toBe(` await expect.poll(dumpTestTree(page)).toBe(`
@ -49,6 +54,7 @@ test('should run tests', async ({ runUITest }) => {
test 3 test 3
`); `);
}); });
});
test('should stop tests', async ({ runUITest }) => { test('should stop tests', async ({ runUITest }) => {
const { page } = await runUITest(basicTestTree); const { page } = await runUITest(basicTestTree);
@ -79,6 +85,7 @@ test('should stop tests', async ({ runUITest }) => {
test 3 test 3
`); `);
}); });
});
test('should toggle Terminal', async ({ runUITest }) => { test('should toggle Terminal', async ({ runUITest }) => {
const { page } = await runUITest(basicTestTree); const { page } = await runUITest(basicTestTree);