* refactor: Standardize import statements and improve code formatting in reactflowUtils.ts * [autofix.ci] apply automated fixes * refactor: Standardize string quotes and improve test readability across multiple test files - Updated string quotes from double to single in various test files for consistency. - Enhanced test readability by replacing specific text selectors with test IDs. - Adjusted wait conditions and element interactions to align with updated selectors. - Ensured all tests maintain functionality while improving code clarity. * [autofix.ci] apply automated fixes * test: Add comprehensive Jest tests for createNewFlow function - Introduced a new test file for the createNewFlow function to validate its behavior. - Covered various scenarios including default value handling, flow parameter processing, edge cases, and special property handling. - Ensured immutability of input parameters and consistency of output for the same inputs. - Mocked dependencies to isolate the function's logic and improve test reliability. * [autofix.ci] apply automated fixes * test: Standardize string quotes and improve readability in auto-save and MCP server tests - Updated string quotes from double to single for consistency across test files. - Enhanced test readability by utilizing test IDs for element selection. - Adjusted wait conditions and interactions to align with updated selectors while maintaining test functionality. * [autofix.ci] apply automated fixes * chore: update ESLint configuration and improve test selectors in auto-save-off.spec.ts - Simplified ESLint configuration by removing unnecessary plugins and options. - Enhanced test selectors in auto-save-off.spec.ts to use test IDs for better reliability and clarity. * chore: enhance ESLint configuration with Prettier integration and improved rules - Added Prettier as a plugin to the ESLint configuration for better code formatting. - Updated parser options and extended rules for improved code quality and consistency. - Ensured compatibility with TypeScript and React environments. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import type { Page } from "playwright/test";
|
|
import { addFlowToTestOnEmptyLangflow } from "./add-flow-to-test-on-empty-langflow";
|
|
|
|
export const awaitBootstrapTest = async (
|
|
page: Page,
|
|
options?: {
|
|
skipGoto?: boolean;
|
|
skipModal?: boolean;
|
|
},
|
|
) => {
|
|
if (!options?.skipGoto) {
|
|
await page.goto("/");
|
|
}
|
|
|
|
await page.waitForSelector('[data-testid="mainpage_title"]', {
|
|
timeout: 30000,
|
|
});
|
|
|
|
const countEmptyButton = await page
|
|
.getByTestId("new_project_btn_empty_page")
|
|
.count();
|
|
if (countEmptyButton > 0) {
|
|
await addFlowToTestOnEmptyLangflow(page);
|
|
}
|
|
|
|
await page.waitForSelector('[id="new-project-btn"]', {
|
|
timeout: 30000,
|
|
});
|
|
|
|
if (!options?.skipModal) {
|
|
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.getByTestId("new-project-btn").click();
|
|
await page.waitForSelector('[data-testid="modal-title"]', {
|
|
timeout: 3000,
|
|
});
|
|
modalCount = await page.getByTestId("modal-title")?.count();
|
|
}
|
|
}
|
|
};
|