e2e: wait for load

pull/460/head
Varun Patil 2023-02-25 18:43:48 -08:00
parent 4121d179b6
commit 3ba717571c
2 changed files with 6 additions and 13 deletions

View File

@ -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");
});
});

View File

@ -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);
});