Skip to content

Commit

Permalink
Refactor keyboard shortcuts to use ControlOrMeta for cross-platform…
Browse files Browse the repository at this point in the history
… compatibility in tests
  • Loading branch information
ogabrielluiz committed Nov 13, 2024
1 parent f2dfd24 commit 03bf6d3
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions src/frontend/tests/extended/regression/generalBugs-shard-7.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,10 @@ test("should be able to select all with ctrl + A on advanced modal", async ({

const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";

if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}

await page.getByTestId("div-generic-node").click();

await page.keyboard.press(`${control}+Shift+A`);
await page.keyboard.press(`ControlOrMeta+Shift+A`);

await page.waitForTimeout(1000);

Expand All @@ -79,35 +74,22 @@ test("should be able to select all with ctrl + A on advanced modal", async ({
await page.getByPlaceholder("Type something...").last().click();
await page.waitForTimeout(1000);

await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("a");
await page.keyboard.up(control);

await page.keyboard.press("ControlOrMeta+a");
await page.waitForTimeout(1000);

await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("c");
await page.keyboard.up(control);
await page.keyboard.press(`ControlOrMeta+C`);

await page.waitForTimeout(1000);

await page.getByPlaceholder("Type something...").nth(2).click();

await page.waitForTimeout(1000);

await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("a");
await page.keyboard.up(control);
await page.keyboard.press("ControlOrMeta+a");

await page.waitForTimeout(1000);

await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("v");
await page.keyboard.up(control);
await page.keyboard.press("ControlOrMeta+v");

value = await page.getByPlaceholder("Type something...").nth(2).inputValue();
expect(value).toBe("ollama_test_ctrl_a_second_input");
Expand Down

0 comments on commit 03bf6d3

Please sign in to comment.