* feat: change advanced params for models
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* fix: ruff erros
* remove Redundant component
* refactor: streamline freeze-path test by removing redundant slider interactions and updating model selection
- Removed unnecessary wait for the default slider display value.
- Updated model selection to use 'gpt-4o-mini-0-option' for varied output in tests.
* [autofix.ci] apply automated fixes
* test: update slider component test to reflect new parameter values and structure
- Modified the test to replace a multiline string with updated values for the slider component.
- Ensured that the new code differs from the original to validate changes.
- Adjusted the test to fill the textarea with the new code after modification.
* ✅ (intComponent.spec.ts): update test assertions to match expected behavior for IntComponent regarding checkbox states
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
167 lines
4.7 KiB
TypeScript
167 lines
4.7 KiB
TypeScript
import { expect, Page, 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";
|
|
|
|
test(
|
|
"user must be able to freeze a path",
|
|
{ tag: ["@release", "@workspace", "@components"] },
|
|
|
|
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: "Basic Prompting" }).click();
|
|
|
|
await initialGPTsetup(page);
|
|
|
|
await page
|
|
.getByTestId("textarea_str_input_value")
|
|
.first()
|
|
.fill(
|
|
"say a random number between 1 and 100000 and a random animal that lives in the sea",
|
|
);
|
|
|
|
await page.getByTestId("dropdown_str_model_name").click();
|
|
await page.getByTestId("gpt-4o-1-option").click();
|
|
|
|
await page.getByTestId("fit_view").click();
|
|
|
|
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByTestId("button_run_chat output").click();
|
|
|
|
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
|
|
|
await page.getByText("built successfully").last().click({
|
|
timeout: 15000,
|
|
});
|
|
|
|
await page
|
|
.getByTestId("output-inspection-message-chatoutput")
|
|
.first()
|
|
.click();
|
|
|
|
const randomTextGeneratedByAI = await page
|
|
.getByPlaceholder("Empty")
|
|
.first()
|
|
.inputValue();
|
|
|
|
await page.getByText("Close").last().click();
|
|
|
|
// Change model to force different output
|
|
await page.getByTestId("dropdown_str_model_name").click();
|
|
await page.getByTestId("gpt-4o-mini-0-option").click();
|
|
|
|
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByTestId("button_run_chat output").click();
|
|
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
|
|
|
await page.getByText("built successfully").last().click({
|
|
timeout: 15000,
|
|
});
|
|
|
|
await page
|
|
.getByTestId("output-inspection-message-chatoutput")
|
|
.first()
|
|
.click();
|
|
|
|
const secondRandomTextGeneratedByAI = await page
|
|
.getByPlaceholder("Empty")
|
|
.first()
|
|
.inputValue();
|
|
|
|
await page.getByText("Close").last().click();
|
|
|
|
await page.waitForSelector("text=OpenAI", {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByText("OpenAI", { exact: true }).last().click();
|
|
|
|
await page.waitForSelector('[data-testid="more-options-modal"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByTestId("more-options-modal").click();
|
|
|
|
await page.waitForSelector('[data-testid="freeze-path-button"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByTestId("freeze-path-button").click();
|
|
|
|
await page.waitForSelector('[data-testid="icon-Snowflake"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
expect(await page.getByTestId("icon-Snowflake").count()).toBeGreaterThan(0);
|
|
|
|
await page.waitForSelector('[data-testid="button_run_chat output"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page.getByTestId("button_run_chat output").click();
|
|
|
|
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
|
|
|
await page.getByText("built successfully").last().click({
|
|
timeout: 15000,
|
|
});
|
|
|
|
await page
|
|
.getByTestId("output-inspection-message-chatoutput")
|
|
.first()
|
|
.click();
|
|
|
|
const thirdRandomTextGeneratedByAI = await page
|
|
.getByPlaceholder("Empty")
|
|
.first()
|
|
.inputValue();
|
|
|
|
await page.getByText("Close").last().click();
|
|
|
|
expect(randomTextGeneratedByAI).not.toEqual(secondRandomTextGeneratedByAI);
|
|
expect(randomTextGeneratedByAI).not.toEqual(thirdRandomTextGeneratedByAI);
|
|
expect(secondRandomTextGeneratedByAI).toEqual(thirdRandomTextGeneratedByAI);
|
|
},
|
|
);
|
|
|
|
async function moveSlider(
|
|
page: Page,
|
|
side: "left" | "right",
|
|
advanced: boolean = false,
|
|
) {
|
|
const thumbSelector = `slider_thumb${advanced ? "_advanced" : ""}`;
|
|
const trackSelector = `slider_track${advanced ? "_advanced" : ""}`;
|
|
|
|
await page.getByTestId(thumbSelector).click();
|
|
|
|
const trackBoundingBox = await page.getByTestId(trackSelector).boundingBox();
|
|
|
|
if (trackBoundingBox) {
|
|
const moveDistance =
|
|
trackBoundingBox.width * 0.1 * (side === "left" ? -1 : 1);
|
|
const centerX = trackBoundingBox.x + trackBoundingBox.width / 2;
|
|
const centerY = trackBoundingBox.y + trackBoundingBox.height / 2;
|
|
|
|
await page.mouse.move(centerX + moveDistance, centerY);
|
|
await page.mouse.down();
|
|
await page.mouse.up();
|
|
}
|
|
}
|