memories/e2e/timeline.spec.ts

53 lines
1.6 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(
2023-02-26 02:27:31 +00:00
await page.locator("img.ximg").count(),
2022-11-06 07:03:01 +00:00
"Number of previews"
).toBeGreaterThan(4);
2022-09-14 18:18:57 +00:00
await page.waitForTimeout(1000);
});
2022-11-06 07:03:01 +00:00
test("Open one image", async ({ page }) => {
await page
.locator("div:nth-child(2) > .p-outer > .img-outer > img")
.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-10-17 01:07:15 +00:00
const i1 = "div:nth-child(2) > div:nth-child(1) > .p-outer";
const i2 = "div:nth-child(2) > div:nth-child(2) > .p-outer";
2022-09-14 18:18:57 +00:00
2022-11-06 07:03:01 +00:00
const src1 = await page
.locator(`${i1} > .img-outer > img`)
.first()
.getAttribute("src");
const src2 = await page
.locator(`${i2} > .img-outer > img`)
.first()
.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);
2022-10-13 03:16:50 +00:00
await page.locator(`${i1}`).hover();
2022-09-16 03:31:21 +00:00
await page.locator(`${i1} > .select`).click();
2022-09-14 18:18:57 +00:00
await page.locator(`${i2}`).click();
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
});