From 41ed0bb50b1710d58043b1bf5aab08bf600cc054 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 19 Mar 2025 07:06:19 -0300 Subject: [PATCH] fix: Improve test accuracy with component generation steps and robust assertions (nightly fix) (#7156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ (Custom Component Generator.spec.ts): Add test case for filling input with custom component description before sending ✨ (nestedComponent.spec.ts): Add test case for toggling legacy switch in sidebar options and checking if it is checked after clicking --- .../integrations/Custom Component Generator.spec.ts | 9 ++++++++- src/frontend/tests/core/unit/nestedComponent.spec.ts | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/frontend/tests/core/integrations/Custom Component Generator.spec.ts b/src/frontend/tests/core/integrations/Custom Component Generator.spec.ts index 72eea35f4..3c30325b0 100644 --- a/src/frontend/tests/core/integrations/Custom Component Generator.spec.ts +++ b/src/frontend/tests/core/integrations/Custom Component Generator.spec.ts @@ -52,6 +52,13 @@ withEventDeliveryModes( await page.getByTestId("playground-btn-flow-io").click(); + await page + .getByTestId("input-chat-playground") + .last() + .fill( + "Create a custom component that can generate a random number between 1 and 100 and is called Langflow Random Number", + ); + await page.getByTestId("button-send").last().click(); await page.waitForTimeout(1000); @@ -64,6 +71,6 @@ withEventDeliveryModes( expect(await page.getByTestId("chat-code-tab").last().isVisible()).toBe( true, ); - expect(textContents).toContain("langflow"); + expect(textContents.toLowerCase()).toContain("langflow"); }, ); diff --git a/src/frontend/tests/core/unit/nestedComponent.spec.ts b/src/frontend/tests/core/unit/nestedComponent.spec.ts index 678dc5962..c2181d730 100644 --- a/src/frontend/tests/core/unit/nestedComponent.spec.ts +++ b/src/frontend/tests/core/unit/nestedComponent.spec.ts @@ -15,6 +15,16 @@ test( await page.getByTestId("sidebar-search-input").click(); await page.getByTestId("sidebar-search-input").fill("alter metadata"); + await page.getByTestId("sidebar-options-trigger").click(); + await page + .getByTestId("sidebar-legacy-switch") + .isVisible({ timeout: 5000 }); + await page.getByTestId("sidebar-legacy-switch").click(); + await expect(page.getByTestId("sidebar-legacy-switch")).toBeChecked(); + await page.getByTestId("sidebar-options-trigger").click(); + + await page.waitForTimeout(500); + await page.waitForSelector('[data-testid="processingAlter Metadata"]', { timeout: 3000, });