refactor: Improve componentHoverAdd.spec test (#4608)
This commit is contained in:
parent
84fa2fcc2f
commit
efca9f9aeb
1 changed files with 15 additions and 11 deletions
|
|
@ -21,19 +21,25 @@ test("user can add components by hovering and clicking the plus icon", async ({
|
||||||
|
|
||||||
while (modalCount === 0) {
|
while (modalCount === 0) {
|
||||||
await page.getByText("New Flow", { exact: true }).click();
|
await page.getByText("New Flow", { exact: true }).click();
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForSelector('[data-testid="modal-title"]', {
|
||||||
|
timeout: 3000,
|
||||||
|
});
|
||||||
modalCount = await page.getByTestId("modal-title")?.count();
|
modalCount = await page.getByTestId("modal-title")?.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start with blank flow
|
// Start with blank flow
|
||||||
await page.getByTestId("blank-flow").click();
|
await page.getByTestId("blank-flow").click();
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForSelector('[data-testid="sidebar-search-input"]', {
|
||||||
|
timeout: 3000,
|
||||||
|
});
|
||||||
|
|
||||||
// Search for a component
|
// Search for a component
|
||||||
await page.getByTestId("sidebar-search-input").click();
|
await page.getByTestId("sidebar-search-input").click();
|
||||||
await page.getByTestId("sidebar-search-input").fill("chat input");
|
await page.getByTestId("sidebar-search-input").fill("chat input");
|
||||||
await page.waitForTimeout(500);
|
|
||||||
|
|
||||||
|
await page.waitForSelector('[data-testid="inputsChat Input"]', {
|
||||||
|
timeout: 2000,
|
||||||
|
});
|
||||||
// Hover over the component and verify plus icon
|
// Hover over the component and verify plus icon
|
||||||
const componentLocator = page.getByTestId("inputsChat Input");
|
const componentLocator = page.getByTestId("inputsChat Input");
|
||||||
// Find the plus icon within the specific component container
|
// Find the plus icon within the specific component container
|
||||||
|
|
@ -48,26 +54,24 @@ test("user can add components by hovering and clicking the plus icon", async ({
|
||||||
|
|
||||||
await expect(opacity).toBe("0");
|
await expect(opacity).toBe("0");
|
||||||
|
|
||||||
// Hover over the component
|
|
||||||
await componentLocator.hover();
|
await componentLocator.hover();
|
||||||
|
// Hover over the component
|
||||||
// Check if the plus icon is visible and has full opacity
|
|
||||||
|
|
||||||
await expect(plusIcon).toBeVisible();
|
await expect(plusIcon).toBeVisible();
|
||||||
|
// Wait for the animation to change the opacity
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(500);
|
||||||
|
|
||||||
const opacityAfterHover = await plusIcon.evaluate((el) =>
|
const opacityAfterHover = await plusIcon.evaluate((el) =>
|
||||||
window.getComputedStyle(el).getPropertyValue("opacity"),
|
window.getComputedStyle(el).getPropertyValue("opacity"),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(Number(opacityAfterHover)).toBeGreaterThan(0);
|
expect(Number(opacityAfterHover)).toBeGreaterThan(0);
|
||||||
|
|
||||||
// Click the plus icon associated with this component
|
// Click the plus icon associated with this component
|
||||||
await plusIcon.click();
|
await plusIcon.click();
|
||||||
await page.waitForTimeout(500);
|
// Wait for the component to be added to the flow
|
||||||
|
await page.waitForSelector(".react-flow__node", { timeout: 1000 });
|
||||||
|
|
||||||
// Verify component was added to the flow
|
// Verify component was added to the flow
|
||||||
const addedComponent = await page.locator(".react-flow__node").first();
|
const addedComponent = page.locator(".react-flow__node").first();
|
||||||
await expect(addedComponent).toBeVisible();
|
await expect(addedComponent).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue