|
|
import { expect, test } from "@playwright/test"; |
|
|
|
|
|
test( |
|
|
"user can add components by hovering and clicking the plus icon", |
|
|
{ tag: ["@release", "@components", "@workspace"] }, |
|
|
|
|
|
async ({ page }) => { |
|
|
|
|
|
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.waitForSelector('[data-testid="modal-title"]', { |
|
|
timeout: 3000, |
|
|
}); |
|
|
modalCount = await page.getByTestId("modal-title")?.count(); |
|
|
} |
|
|
|
|
|
|
|
|
await page.getByTestId("blank-flow").click(); |
|
|
await page.waitForSelector('[data-testid="sidebar-search-input"]', { |
|
|
timeout: 3000, |
|
|
}); |
|
|
|
|
|
|
|
|
await page.getByTestId("sidebar-search-input").click(); |
|
|
await page.getByTestId("sidebar-search-input").fill("chat input"); |
|
|
|
|
|
await page.waitForSelector('[data-testid="inputsChat Input"]', { |
|
|
timeout: 2000, |
|
|
}); |
|
|
|
|
|
const componentLocator = page.getByTestId("inputsChat Input"); |
|
|
|
|
|
const plusIcon = componentLocator.getByTestId("icon-Plus"); |
|
|
|
|
|
|
|
|
const opacity = await plusIcon.evaluate((el) => |
|
|
window.getComputedStyle(el).getPropertyValue("opacity"), |
|
|
); |
|
|
|
|
|
await expect(plusIcon).toBeVisible(); |
|
|
|
|
|
await expect(opacity).toBe("0"); |
|
|
|
|
|
await componentLocator.hover(); |
|
|
|
|
|
await expect(plusIcon).toBeVisible(); |
|
|
|
|
|
await page.waitForTimeout(500); |
|
|
|
|
|
const opacityAfterHover = await plusIcon.evaluate((el) => |
|
|
window.getComputedStyle(el).getPropertyValue("opacity"), |
|
|
); |
|
|
|
|
|
expect(Number(opacityAfterHover)).toBeGreaterThan(0); |
|
|
|
|
|
|
|
|
await plusIcon.click(); |
|
|
|
|
|
await page.waitForSelector(".react-flow__node", { timeout: 1000 }); |
|
|
|
|
|
|
|
|
const addedComponent = page.locator(".react-flow__node").first(); |
|
|
await expect(addedComponent).toBeVisible(); |
|
|
}, |
|
|
); |
|
|
|