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) {
e.preventDefault();
testServerConnection?.stopTestsNoReply({});
} else if (e.code === 'F5') {
} else if ((e.code === 'F5') || (e.code === 'KeyR' && e.altKey)) {
e.preventDefault();
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);
await expect(page.getByTitle('Run all')).toBeEnabled();
await expect(page.getByTitle('Stop')).toBeDisabled();
await expect(page.getByTitle("Run all")).toBeEnabled();
await expect(page.getByTitle("Stop")).toBeDisabled();
await page.getByPlaceholder('Filter (e.g. text, @tag)').fill('test 3');
await page.keyboard.press('F5');
await page.getByPlaceholder("Filter (e.g. text, @tag)").fill("test 3");
await page.keyboard.press(keyboardShortcut);
await expect(page.getByTestId('status-line')).toHaveText('1/1 passed (100%)');
await page.getByPlaceholder('Filter (e.g. text, @tag)').fill('');
await expect(page.getByTestId("status-line")).toHaveText(
"1/1 passed (100%)",
);
await page.getByPlaceholder("Filter (e.g. text, @tag)").fill("");
// Only the filtered test was run.
await expect.poll(dumpTestTree(page)).toBe(`
@ -48,6 +53,7 @@ test('should run tests', async ({ runUITest }) => {
test 2
test 3
`);
});
});
test('should stop tests', async ({ runUITest }) => {
@ -78,6 +84,7 @@ test('should stop tests', async ({ runUITest }) => {
test 2
test 3
`);
});
});
test('should toggle Terminal', async ({ runUITest }) => {