check SO before add keyboard command
This commit is contained in:
parent
2d6a1d193f
commit
ea8b5faad2
3 changed files with 40 additions and 7 deletions
24
src/frontend/package-lock.json
generated
24
src/frontend/package-lock.json
generated
|
|
@ -102,6 +102,7 @@
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"tailwindcss-dotted-background": "^1.1.0",
|
"tailwindcss-dotted-background": "^1.1.0",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
|
"ua-parser-js": "^1.0.37",
|
||||||
"vite": "^4.5.2"
|
"vite": "^4.5.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -11067,6 +11068,29 @@
|
||||||
"node": ">=14.17"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ua-parser-js": {
|
||||||
|
"version": "1.0.37",
|
||||||
|
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.37.tgz",
|
||||||
|
"integrity": "sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/ua-parser-js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "paypal",
|
||||||
|
"url": "https://paypal.me/faisalman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/faisalman"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/unified": {
|
"node_modules/unified": {
|
||||||
"version": "10.1.2",
|
"version": "10.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"tailwindcss-dotted-background": "^1.1.0",
|
"tailwindcss-dotted-background": "^1.1.0",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
|
"ua-parser-js": "^1.0.37",
|
||||||
"vite": "^4.5.2"
|
"vite": "^4.5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
import { expect, test } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
|
import uaParser from "ua-parser-js";
|
||||||
test("LangflowShortcuts", async ({ page }) => {
|
test("LangflowShortcuts", async ({ page }) => {
|
||||||
|
const getUA = await page.evaluate(() => navigator.userAgent);
|
||||||
|
const userAgentInfo = uaParser(getUA);
|
||||||
|
let control = "Control";
|
||||||
|
|
||||||
|
if (userAgentInfo.os.name.includes("Mac")) {
|
||||||
|
control = "Meta";
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto("http://localhost:3000/");
|
await page.goto("http://localhost:3000/");
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
|
@ -22,11 +30,11 @@ test("LangflowShortcuts", async ({ page }) => {
|
||||||
await page.mouse.down();
|
await page.mouse.down();
|
||||||
|
|
||||||
await page.getByTestId("title-LlamaCpp").click();
|
await page.getByTestId("title-LlamaCpp").click();
|
||||||
await page.keyboard.press("Control+e");
|
await page.keyboard.press(`${control}+e`);
|
||||||
await page.locator('//*[@id="saveChangesBtn"]').click();
|
await page.locator('//*[@id="saveChangesBtn"]').click();
|
||||||
|
|
||||||
await page.getByTestId("title-LlamaCpp").click();
|
await page.getByTestId("title-LlamaCpp").click();
|
||||||
await page.keyboard.press("Control+d");
|
await page.keyboard.press(`${control}+d`);
|
||||||
|
|
||||||
let numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
let numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
||||||
if (numberOfNodes != 2) {
|
if (numberOfNodes != 2) {
|
||||||
|
|
@ -46,10 +54,10 @@ test("LangflowShortcuts", async ({ page }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.getByTestId("title-LlamaCpp").click();
|
await page.getByTestId("title-LlamaCpp").click();
|
||||||
await page.keyboard.press("Control+c");
|
await page.keyboard.press(`${control}+c`);
|
||||||
|
|
||||||
await page.getByTestId("title-LlamaCpp").click();
|
await page.getByTestId("title-LlamaCpp").click();
|
||||||
await page.keyboard.press("Control+v");
|
await page.keyboard.press(`${control}+v`);
|
||||||
|
|
||||||
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
||||||
if (numberOfNodes != 2) {
|
if (numberOfNodes != 2) {
|
||||||
|
|
@ -64,13 +72,13 @@ test("LangflowShortcuts", async ({ page }) => {
|
||||||
await page.keyboard.press("Backspace");
|
await page.keyboard.press("Backspace");
|
||||||
|
|
||||||
await page.getByTestId("title-LlamaCpp").click();
|
await page.getByTestId("title-LlamaCpp").click();
|
||||||
await page.keyboard.press("Control+x");
|
await page.keyboard.press(`${control}+x`);
|
||||||
|
|
||||||
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
||||||
if (numberOfNodes != 0) {
|
if (numberOfNodes != 0) {
|
||||||
expect(false).toBeTruthy();
|
expect(false).toBeTruthy();
|
||||||
}
|
}
|
||||||
await page.keyboard.press("Control+v");
|
await page.keyboard.press(`${control}+v`);
|
||||||
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
numberOfNodes = await page.getByTestId("title-LlamaCpp").count();
|
||||||
if (numberOfNodes != 1) {
|
if (numberOfNodes != 1) {
|
||||||
expect(false).toBeTruthy();
|
expect(false).toBeTruthy();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue