Update tests
parent
6d65db6861
commit
d940aa573e
|
@ -1,15 +1,17 @@
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from "@playwright/test";
|
||||||
import { login } from './login';
|
import { login } from "./login";
|
||||||
|
|
||||||
test.beforeEach(login('/folders'));
|
test.beforeEach(login("/folders"));
|
||||||
|
|
||||||
test.describe('Open', () => {
|
test.describe("Open", () => {
|
||||||
test('Look for Folders', async ({ page }) => {
|
test("Look for Folders", async ({ page }) => {
|
||||||
expect(await page.locator('.big-icon').count(), 'Number of folders').toBe(2);
|
expect(await page.locator(".big-icon").count(), "Number of folders").toBe(
|
||||||
|
2
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Open folder', async ({ page }) => {
|
test("Open folder", async ({ page }) => {
|
||||||
await page.locator('text=Local').click();
|
await page.locator("text=Local").click();
|
||||||
await page.waitForSelector('img[src*="core/preview"]');
|
await page.waitForSelector('img[src*="core/preview"]');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
22
e2e/login.ts
22
e2e/login.ts
|
@ -1,16 +1,18 @@
|
||||||
import { expect, PlaywrightTestArgs } from '@playwright/test';
|
import { expect, PlaywrightTestArgs } from "@playwright/test";
|
||||||
|
|
||||||
export function login(route: string) {
|
export function login(route: string) {
|
||||||
return async ({ page }: PlaywrightTestArgs) => {
|
return async ({ page }: PlaywrightTestArgs) => {
|
||||||
await page.setViewportSize({ width: 800, height: 600 })
|
await page.setViewportSize({ width: 800, height: 600 });
|
||||||
await page.goto('http://localhost:8080/index.php/apps/memories' + route)
|
await page.goto("http://localhost:8080/index.php/apps/memories" + route);
|
||||||
|
|
||||||
await page.locator('#user').click();
|
await page.locator("#user").click();
|
||||||
await page.locator('#user').fill('admin');
|
await page.locator("#user").fill("admin");
|
||||||
await page.locator('#user').press('Tab');
|
await page.locator("#user").press("Tab");
|
||||||
await page.locator('#password').fill('password');
|
await page.locator("#password").fill("password");
|
||||||
await page.locator('button[type="submit"]').click();
|
await page.locator('button[type="submit"]').click();
|
||||||
await expect(page).toHaveURL('http://localhost:8080/index.php/apps/memories' + route);
|
await expect(page).toHaveURL(
|
||||||
|
"http://localhost:8080/index.php/apps/memories" + route
|
||||||
|
);
|
||||||
await page.waitForSelector('img[src*="core/preview"]');
|
await page.waitForSelector('img[src*="core/preview"]');
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,38 @@
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from "@playwright/test";
|
||||||
import { login } from './login';
|
import { login } from "./login";
|
||||||
|
|
||||||
test.beforeEach(login('/'));
|
test.beforeEach(login("/"));
|
||||||
|
|
||||||
test.describe('Open', () => {
|
test.describe("Open", () => {
|
||||||
test('Look for Images', async ({ page }) => {
|
test("Look for Images", async ({ page }) => {
|
||||||
expect(await page.locator('img[src*="core/preview"]').count(), 'Number of previews').toBeGreaterThan(4);
|
expect(
|
||||||
|
await page.locator('img[src*="core/preview"]').count(),
|
||||||
|
"Number of previews"
|
||||||
|
).toBeGreaterThan(4);
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Open one image', async ({ page }) => {
|
test("Open one image", async ({ page }) => {
|
||||||
await page.locator('div:nth-child(2) > .p-outer > .img-outer > img').first().click();
|
await page
|
||||||
|
.locator("div:nth-child(2) > .p-outer > .img-outer > img")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
await page.locator('button.header-close').first().click();
|
await page.locator('button[title="Close"]').first().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Select two images and delete', async ({ page }) => {
|
test("Select two images and delete", async ({ page }) => {
|
||||||
const i1 = "div:nth-child(2) > div:nth-child(1) > .p-outer";
|
const i1 = "div:nth-child(2) > div:nth-child(1) > .p-outer";
|
||||||
const i2 = "div:nth-child(2) > div:nth-child(2) > .p-outer";
|
const i2 = "div:nth-child(2) > div:nth-child(2) > .p-outer";
|
||||||
|
|
||||||
const src1 = await page.locator(`${i1} > .img-outer > img`).first().getAttribute('src');
|
const src1 = await page
|
||||||
const src2 = await page.locator(`${i2} > .img-outer > img`).first().getAttribute('src');
|
.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="${src1}"]`).count()).toBe(1);
|
||||||
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(1);
|
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(1);
|
||||||
|
@ -42,4 +54,4 @@ test.describe('Open', () => {
|
||||||
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(0);
|
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(0);
|
||||||
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(0);
|
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue