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:
parent
b9ffce2a8f
commit
a0cd179258
2 changed files with 13 additions and 10 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue