📝 (handleRenderComponent/index.tsx): Add useShallow import for zustand/react/shallow to optimize re-renders

📝 (handleRenderComponent/index.tsx): Introduce isLocked state to handle locked flow functionality
📝 (handleRenderComponent/index.tsx): Update tooltip visibility based on isLocked state
📝 (handleRenderComponent/index.tsx): Update handle style based on isLocked state
📝 (PageComponent/index.tsx): Add useShallow import for zustand/react/shallow to optimize re-renders
📝 (PageComponent/index.tsx): Introduce isLocked state to handle locked flow functionality
📝 (PageComponent/index.tsx): Prevent edge click actions when flow is locked
📝 (PageComponent/index.tsx): Disable edge actions when flow is locked
📝 (PageComponent/index.tsx): Update edge actions based on isLocked state
📝 (lock-flow.spec.ts): Add test to simulate deleting edges when flow is locked
This commit is contained in:
cristhianzl 2025-06-20 10:43:56 -03:00
commit 9898d1cacd
3 changed files with 63 additions and 14 deletions

View file

@ -1,4 +1,4 @@
import { test } from "@playwright/test";
import { expect, Page, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
@ -74,5 +74,42 @@ test(
timeout: 3000,
state: "visible",
});
await tryDeleteEdge(page);
await page.locator(".react-flow__edge-path").nth(0).click();
await page.keyboard.press("Delete");
let numberOfEdges = await page.locator(".react-flow__edge-path").count();
expect(numberOfEdges).toBe(2);
await page.locator(".react-flow__edge-path").nth(0).click();
await page.keyboard.press("Delete");
numberOfEdges = await page.locator(".react-flow__edge-path").count();
expect(numberOfEdges).toBe(1);
await page.locator(".react-flow__edge-path").nth(0).click();
await page.keyboard.press("Delete");
numberOfEdges = await page.locator(".react-flow__edge-path").count();
expect(numberOfEdges).toBe(0);
},
);
async function tryDeleteEdge(page: Page) {
await page.getByTestId("lock_unlock").click();
let numberOfEdges = await page.locator(".react-flow__edge-path").count();
expect(numberOfEdges).toBe(3);
const numberOfTries = 50;
for (let i = 0; i < numberOfTries; i++) {
await page.locator(".react-flow__edge-path").nth(0).click();
await page.keyboard.press("Delete");
await page.locator(".react-flow__edge-path").nth(1).click();
await page.keyboard.press("Delete");
await page.locator(".react-flow__edge-path").nth(2).click();
await page.keyboard.press("Delete");
numberOfEdges = await page.locator(".react-flow__edge-path").count();
expect(numberOfEdges).toBe(3);
}
//unlock the flow
await page.getByTestId("lock_unlock").click();
}