Added alt+s for stopping

This commit is contained in:
tommy-mode 2024-09-30 11:47:39 -04:00
parent ffaa08e607
commit 327a0cd25b
2 changed files with 15 additions and 12 deletions

View file

@ -359,7 +359,7 @@ export const UIModeView: React.FC<{}> = ({
if (e.code === 'Backquote' && e.ctrlKey) {
e.preventDefault();
setIsShowingOutput(!isShowingOutput);
} else if (e.code === 'F5' && e.shiftKey) {
} else if ((e.code === 'F5' && e.shiftKey) || (e.code === 'KeyS' && e.altKey)) {
e.preventDefault();
testServerConnection?.stopTestsNoReply({});
} else if ((e.code === 'F5') || (e.code === 'KeyR' && e.altKey)) {

View file

@ -29,7 +29,7 @@ const basicTestTree = {
};
["F5", "Alt+r"].forEach((keyboardShortcut) => {
test.only(`should run tests with "${keyboardShortcut}"`, async ({
test(`should run tests with "${keyboardShortcut}"`, async ({
runUITest,
}) => {
const { page } = await runUITest(basicTestTree);
@ -56,13 +56,16 @@ const basicTestTree = {
});
});
test('should stop tests', async ({ runUITest }) => {
["Shift+F5", "Alt+s"].forEach((keyboardShortcut) => {
test(`should stop 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.getByTitle('Run all').click();
await page.getByTitle("Run all").click();
await expect.poll(dumpTestTree(page)).toBe(`
a.test.ts
@ -72,10 +75,10 @@ test('should stop tests', async ({ runUITest }) => {
🕦 test 3
`);
await expect(page.getByTitle('Run all')).toBeDisabled();
await expect(page.getByTitle('Stop')).toBeEnabled();
await expect(page.getByTitle("Run all")).toBeDisabled();
await expect(page.getByTitle("Stop")).toBeEnabled();
await page.keyboard.press('Shift+F5');
await page.keyboard.press(keyboardShortcut);
await expect.poll(dumpTestTree(page)).toBe(`
a.test.ts