From 3ba717571c5f76c2e75bf07e21d4ffc6b580d368 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 25 Feb 2023 18:43:48 -0800 Subject: [PATCH] e2e: wait for load --- e2e/folders.spec.ts | 6 +++--- e2e/timeline.spec.ts | 13 +++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/e2e/folders.spec.ts b/e2e/folders.spec.ts index 06a41669..dbdae075 100644 --- a/e2e/folders.spec.ts +++ b/e2e/folders.spec.ts @@ -5,13 +5,13 @@ test.beforeEach(login("/folders")); test.describe("Open", () => { test("Look for Folders", async ({ page }) => { - expect(await page.locator(".big-icon").count(), "Number of folders").toBe( - 2 - ); + const ct = await page.locator(".big-icon").count(); + expect(ct, "Number of folders").toBe(2); }); test("Open folder", async ({ page }) => { await page.locator("text=Local").click(); + await page.waitForTimeout(2000); await page.waitForSelector("img.ximg"); }); }); diff --git a/e2e/timeline.spec.ts b/e2e/timeline.spec.ts index fc77b532..2b4940a7 100644 --- a/e2e/timeline.spec.ts +++ b/e2e/timeline.spec.ts @@ -22,6 +22,8 @@ test.describe("Open", () => { }); test("Select two images and delete", async ({ page }) => { + await page.waitForTimeout(4000); + const i1 = "div:nth-child(2) > div:nth-child(1) > .p-outer"; const i2 = "div:nth-child(2) > div:nth-child(2) > .p-outer"; @@ -43,16 +45,7 @@ test.describe("Open", () => { await page.waitForTimeout(1000); await page.locator('[aria-label="Delete"]').click(); - await page.waitForTimeout(4000); - expect(await page.locator(`img[src="${src1}"]`).count()).toBe(0); - expect(await page.locator(`img[src="${src2}"]`).count()).toBe(0); - - // refresh page - await page.reload(); - await page.waitForTimeout(4000); // cache - await page.reload(); // prevent stale cache issues - await page.waitForTimeout(4000); // cache - await page.waitForSelector("img.ximg"); + await page.waitForTimeout(2000); expect(await page.locator(`img[src="${src1}"]`).count()).toBe(0); expect(await page.locator(`img[src="${src2}"]`).count()).toBe(0); });