2023-09-30 18:56:55 +00:00
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
import { login } from './login';
|
2022-09-14 18:18:57 +00:00
|
|
|
|
2023-09-30 18:56:55 +00:00
|
|
|
test.beforeEach(login('/'));
|
2022-09-14 18:18:57 +00:00
|
|
|
|
2023-09-30 18:56:55 +00:00
|
|
|
test.describe('Open', () => {
|
2023-03-24 09:34:25 +00:00
|
|
|
test.beforeEach(async ({ page }) => {
|
2023-09-30 18:56:55 +00:00
|
|
|
await page.waitForSelector('.img-outer');
|
2023-03-24 09:34:25 +00:00
|
|
|
await page.waitForTimeout(500);
|
|
|
|
});
|
|
|
|
|
2023-09-30 18:56:55 +00:00
|
|
|
test('Look for Images', async ({ page }) => {
|
|
|
|
expect(await page.locator('.img-outer').count(), 'Number of previews').toBeGreaterThan(4);
|
2022-09-14 18:18:57 +00:00
|
|
|
});
|
|
|
|
|
2023-09-30 18:56:55 +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
|
|
|
});
|
|
|
|
|
2023-09-30 18:56:55 +00:00
|
|
|
test('Select two images and delete', async ({ page }) => {
|
|
|
|
const src1 = await page.locator('.img-outer > img').nth(1).getAttribute('src');
|
|
|
|
const src2 = await page.locator('.img-outer > img').nth(2).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-09-30 18:56:55 +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-09-30 18:56:55 +00:00
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
await page.locator('.oc-dialog button.error').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
|
|
|
});
|