memories/e2e/timeline.spec.ts

46 lines
1.4 KiB
TypeScript
Raw Normal View History

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", () => {
test("Look for Images", async ({ page }) => {
expect(
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 }) => {
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 }) => {
2023-02-26 02:43:48 +00:00
await page.waitForTimeout(4000);
2022-11-06 07:03:01 +00:00
const src1 = await page
.locator(".img-outer > img")
.nth(1)
2022-11-06 07:03:01 +00:00
.getAttribute("src");
const src2 = await page
.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);
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
});