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 }) => {
|
2022-09-14 22:50:02 +00:00
|
|
|
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);
|
2022-10-11 00:13:26 +00:00
|
|
|
await page.locator('button.header-close').first().click();
|
2022-09-14 18:18:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Select two images and delete', async ({ page }) => {
|
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
|
|
|
|
|
|
|
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-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();
|
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();
|
2022-10-17 01:22:09 +00:00
|
|
|
await page.waitForTimeout(4000); // cache
|
2022-09-14 22:50:02 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|