* starting realocating components FE * tagging tests * 📝 (.github/workflows/typescript_test.yml): remove unnecessary comment before the Playwright test execution step to improve readability and maintainability * 📝 (.github/changes-filter.yaml): Update paths in changes-filter.yaml to categorize different sections of the project for testing purposes 🔧 (.github/workflows/typescript_test.yml): Refactor workflow to use paths-filter action for determining test suites based on changes in different project sections * ✨ (changes-filter.yaml): reorganize and update paths for test categories, starter projects, components, workspace, api, and database ✨ (components): add new components for GradientWrapper, pageLayout, and paginatorComponent 🔧 (MainPage): update import path for PageLayout component 🔧 (SettingsPage): update import path for PageLayout component 🔧 (StorePage): update import path for PageLayout component * ✨ (frontend): Update import paths for components to use common directory instead of core directory for better organization and consistency 🔧 (frontend): Remove duplicate import of PaginatorComponent in various files and import it from the common directory to reduce redundancy and improve maintainability * 🔧 (changes-filter.yaml): remove unnecessary release section from changes-filter.yaml 🔧 (typescript_test.yml): refactor workflow to support input suites and release flag for test runs * 📝 (changes-filter.yaml): remove unnecessary entries from components section and add missing entries to workspace section for better organization and filtering of changes 🔧 (changes-filter.yaml): update changes-filter.yaml to include missing utils files in the frontend/src/utils directory 🔧 (typescript_test.yml): remove redundant code block that sets SUITES variable to default values as it is no longer needed due to changes in the changes-filter.yaml file * ✨ (actionsMainPage-shard-1.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (store-shard-2.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (generalBugs-shard-4.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (generalBugs-shard-9.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (deleteComponents.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity 📝 (deleteFlows.spec.ts): Update test tags to remove unnecessary tags for better organization and clarity ✨ (dragAndDrop.spec.ts): Refactor drag and drop test to improve readability and maintainability ✨ (flowPage.spec.ts): Refactor save test in Flow Page to improve readability and maintainability ✨ (store-shard-0.spec.ts): Refactor Store test to improve readability and maintainability ✨ (store-shard-1.spec.ts): Refactor Store test to improve readability and maintainability ✨ (store-shard-3.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency ✨ (userSettings.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency ✨ (general-bugs-shard-3909.spec.ts): Remove unnecessary tags from test descriptions to improve clarity and consistency 📝 (frontend): Update test tags in regression tests to remove unnecessary tags for better organization and clarity 📝 (frontend): Update test file paths in tsconfig.json to match the new file structure for consistency and maintainability * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes * Update paths-filter action to v3 and adjust filter configuration file * Add logging to matrix setup in TypeScript test workflow * Refactor decisionFlow.spec.ts to improve test setup and execution flow * Refactor import paths for genericIconComponent and shadTooltipComponent in PlaygroundButton component * feat: add release input to CI workflows for enhanced deployment control * Fix: Correct 'release' input type in CI workflow configuration * [autofix.ci] apply automated fixes * Refactor Blog Writer test: streamline setup and interaction steps * Refactor test cases to improve modal handling and streamline API key input logic * Add test grep pattern to GitHub Actions workflow for targeted test execution - Introduced `test_grep` output in the `determine-test-suite` job to generate a grep pattern based on changed files or input suites. - Updated Playwright test execution to use the generated grep pattern, allowing for more targeted test runs. - Enhanced the `Set Matrix` step to include tag processing for test filtering. * Enhance tag filtering in test workflow with regex lookaheads * Fix syntax for default suite input in GitHub Actions workflow * Update GitHub Actions to handle empty suite input for release builds * Escape regex lookaheads and quotes for GitHub Actions in test workflow * Update regex pattern and quote escaping in TypeScript test workflow * Use single quotes for echo command in GitHub Actions script * Refactor tag handling in GitHub Actions to use OR logic for grep patterns * 🔧 (FlowPage/index.tsx): Remove unnecessary empty line to improve code readability and consistency * 📝 (FlowPage/index.tsx): add missing line break for better code readability * Refactor import path and reorder CSS classes for consistency in UpdateAllComponents component * [autofix.ci] apply automated fixes * Update import path for PaginatorComponent in AdminPage index.tsx * ✨ (logs.spec.ts): introduce a new variable 'modalCount' to keep track of the number of modals opened in the test suite * 📝 (filterSidebar.spec.ts): remove unnecessary test steps related to filter removal and sidebar interactions to simplify and improve test focus on main functionality * ✅ (logs.spec.ts): add tests to ensure proper interaction with logs feature in the frontend application * ✅ (similarity.spec.ts): add a test tag for release and components to categorize the test case 💡 (similarity.spec.ts): add a comment to explain the purpose of the test case and the condition for skipping the test * ✅ (decisionFlow.spec.ts): add missing newline before async function declaration to improve code readability * ✅ (textInputOutput.spec.ts): skip the test for TextInputOutputComponent to exclude it from the test suite temporarily --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
205 lines
7.4 KiB
TypeScript
205 lines
7.4 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import * as dotenv from "dotenv";
|
|
import path from "path";
|
|
|
|
test.skip(
|
|
"TextInputOutputComponent",
|
|
{ tag: ["@release", "@components"] },
|
|
async ({ page }) => {
|
|
// commented out because new playground does not support text io yet
|
|
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 page.goto("/");
|
|
await page.waitForSelector('[data-testid="mainpage_title"]', {
|
|
timeout: 30000,
|
|
});
|
|
await page.waitForSelector('[id="new-project-btn"]', {
|
|
timeout: 30000,
|
|
});
|
|
let modalCount = 0;
|
|
try {
|
|
const modalTitleElement = await page?.getByTestId("modal-title");
|
|
if (modalTitleElement) {
|
|
modalCount = await modalTitleElement.count();
|
|
}
|
|
} catch (error) {
|
|
modalCount = 0;
|
|
}
|
|
while (modalCount === 0) {
|
|
await page.getByText("New Flow", { exact: true }).click();
|
|
await page.waitForTimeout(3000);
|
|
modalCount = await page.getByTestId("modal-title")?.count();
|
|
}
|
|
await page.waitForSelector('[data-testid="blank-flow"]', {
|
|
timeout: 30000,
|
|
});
|
|
await page.getByTestId("blank-flow").click();
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("text input");
|
|
await page.waitForTimeout(1000);
|
|
await page
|
|
.getByTestId("inputsText Input")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await page.mouse.up();
|
|
await page.mouse.down();
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("openai");
|
|
await page.waitForTimeout(1000);
|
|
await page
|
|
.getByTestId("modelsOpenAI")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await page.mouse.up();
|
|
await page.mouse.down();
|
|
await page.waitForSelector('[data-testid="fit_view"]', {
|
|
timeout: 100000,
|
|
});
|
|
await page.getByTestId("fit_view").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
let visibleElementHandle;
|
|
const elementsTextInputOutput = await page
|
|
.getByTestId("handle-textinput-shownode-text-right")
|
|
.all();
|
|
for (const element of elementsTextInputOutput) {
|
|
if (await element.isVisible()) {
|
|
visibleElementHandle = element;
|
|
break;
|
|
}
|
|
}
|
|
await visibleElementHandle.waitFor({
|
|
state: "visible",
|
|
timeout: 30000,
|
|
});
|
|
await visibleElementHandle.hover();
|
|
await page.mouse.down();
|
|
for (const element of elementsTextInputOutput) {
|
|
if (await element.isVisible()) {
|
|
visibleElementHandle = element;
|
|
break;
|
|
}
|
|
}
|
|
await visibleElementHandle.waitFor({
|
|
state: "visible",
|
|
timeout: 30000,
|
|
});
|
|
// Move to the second element
|
|
await visibleElementHandle.hover();
|
|
// Release the mouse
|
|
await page.mouse.up();
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("text output");
|
|
await page
|
|
.getByTestId("outputsText Output")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await page.mouse.up();
|
|
await page.mouse.down();
|
|
await page.waitForSelector('[data-testid="fit_view"]', {
|
|
timeout: 100000,
|
|
});
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
await page.getByTestId("zoom_out").click();
|
|
const elementsOpenAiOutput = await page
|
|
.getByTestId("handle-openaimodel-shownode-text-right")
|
|
.all();
|
|
for (const element of elementsOpenAiOutput) {
|
|
if (await element.isVisible()) {
|
|
visibleElementHandle = element;
|
|
break;
|
|
}
|
|
}
|
|
await visibleElementHandle.waitFor({
|
|
state: "visible",
|
|
timeout: 30000,
|
|
});
|
|
// Click and hold on the first element
|
|
await visibleElementHandle.hover();
|
|
await page.mouse.down();
|
|
const elementTextOutputInput = await page
|
|
.getByTestId("handle-textoutput-shownode-text-left")
|
|
.all();
|
|
for (const element of elementTextOutputInput) {
|
|
if (await element.isVisible()) {
|
|
visibleElementHandle = element;
|
|
break;
|
|
}
|
|
}
|
|
await visibleElementHandle.waitFor({
|
|
state: "visible",
|
|
timeout: 30000,
|
|
});
|
|
// Move to the second element
|
|
await visibleElementHandle.hover();
|
|
// Release the mouse
|
|
await page.mouse.up();
|
|
await page
|
|
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
|
|
.getByTestId("textarea_str_input_value")
|
|
.fill("This is a test!");
|
|
let outdatedComponents = await page
|
|
.getByTestId("icon-AlertTriangle")
|
|
.count();
|
|
while (outdatedComponents > 0) {
|
|
await page.getByTestId("icon-AlertTriangle").first().click();
|
|
await page.waitForTimeout(1000);
|
|
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
|
|
}
|
|
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
|
while (filledApiKey > 0) {
|
|
await page.getByTestId("remove-icon-badge").first().click();
|
|
await page.waitForTimeout(1000);
|
|
filledApiKey = await page.getByTestId("remove-icon-badge").count();
|
|
}
|
|
const apiKeyInput = page.getByTestId("popover-anchor-input-api_key");
|
|
const isApiKeyInputVisible = await apiKeyInput.isVisible();
|
|
if (isApiKeyInputVisible) {
|
|
await apiKeyInput.fill(process.env.OPENAI_API_KEY ?? "");
|
|
}
|
|
await page.getByTestId("dropdown_str_model_name").click();
|
|
await page.getByTestId("gpt-4o-1-option").click();
|
|
await page.waitForTimeout(1000);
|
|
await page.getByText("Playground", { exact: true }).last().click();
|
|
await page.getByTestId("button_run_text_output").click();
|
|
await page
|
|
.getByTestId(/^rf__node-TextOutput-[a-zA-Z0-9]+$/)
|
|
.getByTestId("output-inspection-text")
|
|
.click();
|
|
await page.getByText("Run Flow", { exact: true }).click();
|
|
await page.waitForTimeout(5000);
|
|
let textInputContent = await page
|
|
.getByPlaceholder("Enter text...")
|
|
.textContent();
|
|
expect(textInputContent).toBe("This is a test!");
|
|
await page.getByText("Outputs", { exact: true }).nth(1).click();
|
|
await page.getByText("Text Output", { exact: true }).nth(2).click();
|
|
let contentOutput = await page
|
|
.getByPlaceholder("Enter text...")
|
|
.inputValue();
|
|
expect(contentOutput).not.toBe(null);
|
|
await page.keyboard.press("Escape");
|
|
await page
|
|
.getByTestId(/^rf__node-TextInput-[a-zA-Z0-9]+$/)
|
|
.getByTestId("textarea_str_input_value")
|
|
.fill("This is a test, again just to be sure!");
|
|
await page.getByText("Playground", { exact: true }).last().click();
|
|
await page.getByText("Run Flow", { exact: true }).click();
|
|
await page.waitForTimeout(5000);
|
|
textInputContent = await page
|
|
.getByPlaceholder("Enter text...")
|
|
.textContent();
|
|
expect(textInputContent).toBe("This is a test, again just to be sure!");
|
|
await page.getByText("Outputs", { exact: true }).nth(1).click();
|
|
await page.getByText("Text Output", { exact: true }).nth(2).click();
|
|
contentOutput = await page.getByPlaceholder("Enter text...").inputValue();
|
|
expect(contentOutput).not.toBe(null);
|
|
},
|
|
);
|