langflow/src/frontend/tests/core/features/componentHoverAdd.spec.ts
Deon Sanchez 85cffda753
LFEN-215 HomePage Uplift (#4242)
* refactor: Remove CustomHeader component from AppWrapperPage

* refactor: Remove unused code and fix formatting in MainPage component

- Remove commented out code and unused imports
- Fix indentation and formatting issues in the component

* colors update and component building

* refactor: Update grid and list components in MainPage

- Update grid component in MainPage to use custom navigation hook
- Add folderId parameter to editFlowLink in grid component
- Update list component in MainPage to use custom navigation hook
- Add folderId parameter to editFlowLink in list component

Refactor the grid and list components in MainPage to use the custom navigation hook instead of the react-router-dom's useNavigate hook. This allows for better control and customization of navigation within the components. Additionally, the editFlowLink now includes the folderId parameter when navigating to the flow edit page.

Closes #<issue_number>

* refactor: Update grid and list components in MainPage

Refactor the grid and list components in the MainPage to improve performance and enhance user experience. This includes updating the styling, optimizing code, and fixing formatting issues.

* Refactor header component to dynamically display folder name

* Refactor CSS styles and button component

- Update CSS styles in applies.css to adjust the position of the header notifications dot.
- Refactor the button component in button.tsx to fix a typo in the class names.

Closes #4259

* Refactor folder store and sidebar components

* Refactor header component to dynamically toggle folder sidebar visibility

* Refactor CSS styles and button component

* Refactor CSS styles and button component

* Refactor CSS styles to adjust the width of the text container

* Refactor dropdown and grid components to handle playground click

* Refactor folder sidebar and list components

* Refactor CSS styles and components for HeaderMenu, GridComponent, and ListComponent

* Refactor CSS styles and components for HeaderMenu, GridComponent, ListComponent, dropdown, and button

* Refactor CSS styles to adjust the width of the text container in ListComponent

* refactor: Update folder name display in EmptyPage component

* refactor: Update folder name display in FlowMenu component

* refactor: Update folder name display in AccountMenu and EmptyPage components

* refactor: Update folder name display in AccountMenu, EmptyPage, and FlowMenu components

* refactor: Update folder name display in AppHeader, DashboardWrapperPage, and HomePage components

* refactor: Update folder name display in MainPage components

- Update folder name display in AppHeader, DashboardWrapperPage, and HomePage components
- Update folder name display in AccountMenu, EmptyPage, and FlowMenu components
- Update folder name display in AccountMenu and EmptyPage components
- Update folder name display in FlowMenu component
- Update folder name display in EmptyPage component

Update the folder name display in various components of the MainPage. This ensures that the folder names are correctly displayed in the UI. The affected components include AppHeader, DashboardWrapperPage, HomePage, AccountMenu, EmptyPage, and FlowMenu. This refactor improves the consistency and user experience of the application.

* refactor: Update folder name display in EmptyPage and HomePage components

* refactor: Update folder name display in AppHeader, DashboardWrapperPage, and HomePage components

* refactor: Update folder name display in MainPage components

* file organization

* Refactor folder name display in MainPage, ListComponent, and HomePage components

* Refactor folder name display in MainPage components

* test fixes

* test fixes part 2
2024-11-01 17:23:10 -03:00

73 lines
2.1 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("user can add components by hovering and clicking the plus icon", async ({
page,
}) => {
// Navigate to homepage and handle initial modal
await page.goto("/");
await page.waitForSelector('[data-testid="mainpage_title"]', {
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();
}
// Start with blank flow
await page.getByTestId("blank-flow").click();
await page.waitForTimeout(1000);
// Search for a component
await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat input");
await page.waitForTimeout(500);
// Hover over the component and verify plus icon
const componentLocator = page.getByTestId("inputsChat Input");
// Find the plus icon within the specific component container
const plusIcon = componentLocator.getByTestId("icon-Plus");
// Get the opacity
const opacity = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
await expect(plusIcon).toBeVisible();
await expect(opacity).toBe("0");
// Hover over the component
await componentLocator.hover();
// Check if the plus icon is visible and has full opacity
await expect(plusIcon).toBeVisible();
await page.waitForTimeout(500);
const opacityAfterHover = await plusIcon.evaluate((el) =>
window.getComputedStyle(el).getPropertyValue("opacity"),
);
await expect(opacityAfterHover).toBe("1");
// Click the plus icon associated with this component
await plusIcon.click();
await page.waitForTimeout(500);
// Verify component was added to the flow
const addedComponent = await page.locator(".react-flow__node").first();
await expect(addedComponent).toBeVisible();
});