memories/e2e/timeline.spec.ts

43 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-09-14 18:18:57 +00:00
import { test, expect } from '@playwright/test';
import { login } from './login';
test.beforeEach(login('/'));
test.describe('Open', () => {
test('Look for Images', async ({ page }) => {
expect(await page.locator('img[src*="core/preview"]').count(), 'Number of previews').toBeGreaterThan(4);
2022-09-14 18:18:57 +00:00
await page.waitForTimeout(1000);
});
test('Open one image', async ({ page }) => {
await page.locator('div:nth-child(2) > .p-outer > .img-outer > img').first().click();
await page.waitForTimeout(1000);
await page.locator('button:has-text("Close")').first().click();
});
test('Select two images and delete', async ({ page }) => {
const i1 = "div:nth-child(2) > .photo-row > div:nth-child(1) > .p-outer";
const i2 = "div:nth-child(2) > .photo-row > div:nth-child(2) > .p-outer";
2022-09-14 18:18:57 +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');
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(1);
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(1);
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();
2022-09-14 18:18:57 +00:00
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.waitForSelector('img[src*="core/preview"]');
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);
});
});