refactor: Improve time and use waitForSelector in folder tests (#4614)

* refactor: Improve time and use waitForSelector in folder tests

* add comment for documentation

* Refactor componentHoverAdd test to use opacity check instead of exact value
This commit is contained in:
anovazzi1 2024-11-18 18:03:06 -03:00 committed by GitHub
commit a0cd179258
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View file

@ -61,7 +61,7 @@ test("user can add components by hovering and clicking the plus icon", async ({
window.getComputedStyle(el).getPropertyValue("opacity"),
);
await expect(opacityAfterHover).toBe("1");
await expect(Number(opacityAfterHover)).toBeGreaterThan(0);
// Click the plus icon associated with this component
await plusIcon.click();

View file

@ -23,7 +23,9 @@ test("CRUD folders", async ({ page }) => {
while (modalCount === 0) {
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();
}
await page.getByTestId("side_nav_options_all-templates").click();
@ -46,7 +48,7 @@ test("CRUD folders", async ({ page }) => {
.getByText("New Folder")
.last()
.isVisible();
await page.waitForTimeout(1000);
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")
@ -75,8 +77,9 @@ test("CRUD folders", async ({ page }) => {
await page.getByTestId("btn-delete-folder").click();
await page.getByText("Delete").last().click();
await page.waitForTimeout(1000);
await page.getByText("Folder deleted successfully").isVisible();
await expect(page.getByText("Folder deleted successfully")).toBeVisible({
timeout: 3000,
});
});
test("add a flow into a folder by drag and drop", async ({ page }) => {
@ -108,8 +111,9 @@ test("add a flow into a folder by drag and drop", async ({ page }) => {
await page.getByTestId("sidebar-nav-My Projects").dispatchEvent("drop", {
dataTransfer,
});
// wait for the file to be uploaded failed with waitforselector
await page.waitForTimeout(3000);
await page.waitForTimeout(1000);
const genericNode = page.getByTestId("div-generic-node");
const elementCount = await genericNode?.count();
@ -119,8 +123,6 @@ test("add a flow into a folder by drag and drop", async ({ page }) => {
await page.getByTestId("sidebar-nav-My Projects").click();
await page.waitForTimeout(3000);
await page.waitForSelector("text=Getting Started:", {
timeout: 100000,
});
@ -161,7 +163,9 @@ test("change flow folder", async ({ page }) => {
while (modalCount === 0) {
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();
}
await page.getByTestId("side_nav_options_all-templates").click();
@ -185,7 +189,6 @@ test("change flow folder", async ({ page }) => {
.getByText("New Folder")
.last()
.isVisible();
await page.waitForTimeout(1000);
await page
.locator("[data-testid='folder-sidebar']")
.getByText("New Folder")