fix: Notes nodes width resets to default on page reload (#6025)

* fix note node size

* ♻️ (NoteNode/index.tsx): remove commented out code for debounced resize handler to improve code readability and maintainability

* feat: update NoteNode to resize and persist dimensions in state

* 🐛 (generalBugs-shard-10.spec.ts): fix clicking on the last element with the text "openai" instead of the first one to match the intended behavior
✨ (generalBugs-shard-10.spec.ts): refactor test to use forEach loop for better readability and accuracy in comparing text contents

* 🐛 (general-bugs-save-changes-on-node.spec.ts): add 500ms delay to fix flakiness in tests related to clicking elements and waiting for selectors to appear

* ✨ (appHeaderComponent/index.tsx): add data-testid attribute to app header for testing purposes
📝 (general-bugs-save-changes-on-node.spec.ts): update verifyTextareaValue function to accept an additional parameter flowName for better test coverage and clarity
📝 (general-bugs-save-changes-on-node.spec.ts): add functionality to input and fill a random flow name in the test scenario for improved test coverage and reliability

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Cristhian Zanforlin Lousa 2025-02-05 15:53:50 -03:00 • committed by GitHub
commit 8a7d7ef62f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 2357 additions and 4133 deletions

View file

@ -1,7 +1,11 @@
import { expect, Page, test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
async function verifyTextareaValue(page: Page, value: string) {
async function verifyTextareaValue(
page: Page,
value: string,
flowName: string,
) {
await page
.getByTestId("textarea_str_input_value")
.waitFor({ state: "visible" });
@ -9,6 +13,8 @@ async function verifyTextareaValue(page: Page, value: string) {
await expect(page.getByTestId("textarea_str_input_value")).toHaveValue(value);
await page.waitForTimeout(500);
await page.getByTestId("icon-ChevronLeft").first().click();
await page.waitForSelector('[data-testid="list-card"]', {
@ -16,13 +22,15 @@ async function verifyTextareaValue(page: Page, value: string) {
state: "visible",
});
await page.getByTestId("list-card").first().click();
await page.waitForTimeout(500);
await page.getByText(flowName).first().click();
await page.waitForSelector('[data-testid="textarea_str_input_value"]', {
timeout: 5000,
state: "visible",
});
await page.waitForTimeout(500);
const inputValue = await page
.getByTestId("textarea_str_input_value")
.inputValue();
@ -37,6 +45,8 @@ test(
Math.random().toString(36).substring(2, 8),
);
const randomFlowName = Math.random().toString(36).substring(2, 8);
await awaitBootstrapTest(page);
await page.getByTestId("blank-flow").click();
@ -45,6 +55,12 @@ test(
state: "visible",
});
await page.getByTestId("input-flow-name").click();
await page.getByTestId("input-flow-name").fill(randomFlowName);
await page.keyboard.press("Enter");
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("text output");
@ -56,9 +72,11 @@ test(
state: "visible",
});
await page.getByTestId("app-header").first().click();
for (const value of randomValues) {
try {
await verifyTextareaValue(page, value);
await verifyTextareaValue(page, value, randomFlowName);
} catch (error) {
console.error(`Failed to verify value: ${value}`, error);
throw error;

View file

@ -29,7 +29,7 @@ test(
await page.getByTestId("fit_view").click();
await page.getByText("openai").first().click();
await page.getByText("openai").last().click();
await page.keyboard.press("Delete");
//connection 1
@ -94,8 +94,8 @@ test(
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText2 = textContents2.join(" ");
expect(concatAllText2).toBe(concatAllText);
textContents2.forEach((text) => {
expect(text).toBe(concatAllText);
});
},
);