langflow/src/frontend/tests/core/integrations/Simple Agent.spec.ts
Cristhian Zanforlin Lousa 9f331d67e5
test: update workflow configuration and Financial Agent JSON structure (nightly fix) (#7112)
*  (test_apply_json_filter.py): update test data generation to exclude whitespace characters and control characters in dictionary keys to improve data quality and reliability

* fix tests
2025-03-17 17:54:21 -03:00

47 lines
1.4 KiB
TypeScript

import { expect, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
import { withEventDeliveryModes } from "../../utils/withEventDeliveryModes";
withEventDeliveryModes(
"Simple Agent",
{ tag: ["@release", "@starter-projects"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
if (!process.env.CI) {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
}
await awaitBootstrapTest(page);
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Simple Agent" }).first().click();
await initialGPTsetup(page);
await page.getByTestId("textarea_str_input_value").first().fill("Hello");
await page.getByTestId("button_run_chat output").last().click();
await page.waitForSelector("text=built successfully", {
timeout: 10000 * 60 * 3,
});
await page.getByTestId("playground-btn-flow-io").click();
const textContents = await page
.getByTestId("div-chat-message")
.allTextContents();
const concatAllText = textContents.join(" ").toLowerCase();
expect(concatAllText).toContain("how can i assist you today?");
expect(concatAllText.length).toBeGreaterThan(10);
},
);