2022-11-06 07:03:01 +00:00
|
|
|
import { test, expect } from "@playwright/test";
|
|
|
|
import { login } from "./login";
|
2022-09-14 18:18:57 +00:00
|
|
|
|
2022-11-06 07:03:01 +00:00
|
|
|
test.beforeEach(login("/"));
|
2022-09-14 18:18:57 +00:00
|
|
|
|
2022-11-06 07:03:01 +00:00
|
|
|
test.describe("Open", () => {
|
2023-03-24 09:34:25 +00:00
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
await page.waitForSelector(".img-outer");
|
|
|
|
await page.waitForTimeout(500);
|
|
|
|
});
|
|
|
|
|
2022-11-06 07:03:01 +00:00
|
|
|
test("Look for Images", async ({ page }) => {
|
|
|
|
expect(
|
2023-03-24 04:48:27 +00:00
|
|
|
await page.locator(".img-outer").count(),
|
2022-11-06 07:03:01 +00:00
|
|
|
"Number of previews"
|
|
|
|
).toBeGreaterThan(4);
|
2022-09-14 18:18:57 +00:00
|
|
|
});
|
|
|
|
|
2022-11-06 07:03:01 +00:00
|
|
|
test("Open one image", async ({ page }) => {
|
2023-03-24 04:48:27 +00:00
|
|
|
await page.locator(".img-outer").first().click();
|
2022-09-14 18:18:57 +00:00
|
|
|
await page.waitForTimeout(1000);
|
2022-11-06 07:03:01 +00:00
|
|
|
await page.locator('button[title="Close"]').first().click();
|
2022-09-14 18:18:57 +00:00
|
|
|
});
|
|
|
|
|
2022-11-06 07:03:01 +00:00
|
|
|
test("Select two images and delete", async ({ page }) => {
|
|
|
|
const src1 = await page
|
2023-03-24 04:48:27 +00:00
|
|
|
.locator(".img-outer > img")
|
|
|
|
.nth(1)
|
2022-11-06 07:03:01 +00:00
|
|
|
.getAttribute("src");
|
|
|
|
const src2 = await page
|
2023-03-24 04:48:27 +00:00
|
|
|
.locator(".img-outer > img")
|
|
|
|
.nth(2)
|
2022-11-06 07:03:01 +00:00
|
|
|
.getAttribute("src");
|
2022-09-14 18:18:57 +00:00
|
|
|
|
|
|
|
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(1);
|
|
|
|
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(1);
|
|
|
|
|
2023-03-24 04:48:27 +00:00
|
|
|
await page.locator(".img-outer").nth(1).hover();
|
|
|
|
await page.locator(".p-outer > .select").nth(1).click();
|
|
|
|
await page.locator(".img-outer").nth(2).click();
|
2022-09-14 18:18:57 +00:00
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
|
2022-09-16 23:26:29 +00:00
|
|
|
await page.locator('[aria-label="Delete"]').click();
|
2023-02-26 02:43:48 +00:00
|
|
|
await page.waitForTimeout(2000);
|
2022-09-14 18:18:57 +00:00
|
|
|
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(0);
|
|
|
|
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(0);
|
|
|
|
});
|
2022-11-06 07:03:01 +00:00
|
|
|
});
|