Update e2e tests

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/563/head
Varun Patil 2023-03-23 21:48:27 -07:00
parent 9e43075df4
commit 897e9a2e70
5 changed files with 39 additions and 46 deletions

View File

@ -12,6 +12,7 @@ test.describe("Open", () => {
test("Open folder", async ({ page }) => {
await page.locator("text=Local").click();
await page.waitForTimeout(2000);
await page.waitForSelector("img.ximg");
const elems = await page.locator(".img-outer").all();
expect(elems.length).toBeGreaterThanOrEqual(3);
});
});

View File

@ -6,13 +6,12 @@ export function login(route: string) {
await page.goto("http://localhost:8080/index.php/apps/memories" + route);
await page.locator("#user").click();
await page.locator("#user").fill("admin");
await page.locator("#user").fill("varun");
await page.locator("#user").press("Tab");
await page.locator("#password").fill("password");
await page.locator("#password").fill("admin");
await page.locator('button[type="submit"]').click();
await expect(page).toHaveURL(
"http://localhost:8080/index.php/apps/memories" + route
);
await page.waitForSelector("img.ximg");
};
}

View File

@ -6,17 +6,13 @@ test.beforeEach(login("/"));
test.describe("Open", () => {
test("Look for Images", async ({ page }) => {
expect(
await page.locator("img.ximg").count(),
await page.locator(".img-outer").count(),
"Number of previews"
).toBeGreaterThan(4);
await page.waitForTimeout(1000);
});
test("Open one image", async ({ page }) => {
await page
.locator("div:nth-child(2) > .p-outer > .img-outer")
.first()
.click();
await page.locator(".img-outer").first().click();
await page.waitForTimeout(1000);
await page.locator('button[title="Close"]').first().click();
});
@ -24,24 +20,21 @@ test.describe("Open", () => {
test("Select two images and delete", async ({ page }) => {
await page.waitForTimeout(4000);
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 src1 = await page
.locator(`${i1} > .img-outer > img`)
.first()
.locator(".img-outer > img")
.nth(1)
.getAttribute("src");
const src2 = await page
.locator(`${i2} > .img-outer > img`)
.first()
.locator(".img-outer > img")
.nth(2)
.getAttribute("src");
expect(await page.locator(`img[src="${src1}"]`).count()).toBe(1);
expect(await page.locator(`img[src="${src2}"]`).count()).toBe(1);
await page.locator(`${i1}`).hover();
await page.locator(`${i1} > .select`).click();
await page.locator(`${i2}`).click();
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();
await page.waitForTimeout(1000);
await page.locator('[aria-label="Delete"]').click();

48
package-lock.json generated
View File

@ -35,10 +35,10 @@
"devDependencies": {
"@nextcloud/browserslist-config": "^2.3.0",
"@nextcloud/webpack-vue-config": "^5.4.0",
"@playwright/test": "^1.31.2",
"@playwright/test": "^1.32.0",
"@types/url-parse": "^1.4.8",
"@types/videojs-contrib-quality-levels": "^2.0.1",
"playwright": "^1.31.2",
"playwright": "^1.32.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"workbox-webpack-plugin": "^6.5.4"
@ -2096,13 +2096,13 @@
}
},
"node_modules/@playwright/test": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.31.2.tgz",
"integrity": "sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.0.tgz",
"integrity": "sha512-zOdGloaF0jeec7hqoLqM5S3L2rR4WxMJs6lgiAeR70JlH7Ml54ZPoIIf3X7cvnKde3Q9jJ/gaxkFh8fYI9s1rg==",
"dev": true,
"dependencies": {
"@types/node": "*",
"playwright-core": "1.31.2"
"playwright-core": "1.32.0"
},
"bin": {
"playwright": "cli.js"
@ -7766,13 +7766,13 @@
}
},
"node_modules/playwright": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.31.2.tgz",
"integrity": "sha512-jpC47n2PKQNtzB7clmBuWh6ftBRS/Bt5EGLigJ9k2QAKcNeYXZkEaDH5gmvb6+AbcE0DO6GnXdbl9ogG6Eh+og==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.0.tgz",
"integrity": "sha512-zQVzxTGoC/ak2Zu0l3CeBGQ6z5oOka5ecUOk+5QbmAerih6CaVsjY9BjjhiN+UOImd3xLiNeCcmLEWcXlz1Dlg==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"playwright-core": "1.31.2"
"playwright-core": "1.32.0"
},
"bin": {
"playwright": "cli.js"
@ -7782,9 +7782,9 @@
}
},
"node_modules/playwright-core": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.31.2.tgz",
"integrity": "sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.0.tgz",
"integrity": "sha512-Z9Ij17X5Z3bjpp6XKujGBp9Gv4eViESac9aDmwgQFUEJBW0K80T21m/Z+XJQlu4cNsvPygw33b6V1Va6Bda5zQ==",
"dev": true,
"bin": {
"playwright": "cli.js"
@ -12877,14 +12877,14 @@
"requires": {}
},
"@playwright/test": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.31.2.tgz",
"integrity": "sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.32.0.tgz",
"integrity": "sha512-zOdGloaF0jeec7hqoLqM5S3L2rR4WxMJs6lgiAeR70JlH7Ml54ZPoIIf3X7cvnKde3Q9jJ/gaxkFh8fYI9s1rg==",
"dev": true,
"requires": {
"@types/node": "*",
"fsevents": "2.3.2",
"playwright-core": "1.31.2"
"playwright-core": "1.32.0"
}
},
"@popperjs/core": {
@ -17202,18 +17202,18 @@
}
},
"playwright": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.31.2.tgz",
"integrity": "sha512-jpC47n2PKQNtzB7clmBuWh6ftBRS/Bt5EGLigJ9k2QAKcNeYXZkEaDH5gmvb6+AbcE0DO6GnXdbl9ogG6Eh+og==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.32.0.tgz",
"integrity": "sha512-zQVzxTGoC/ak2Zu0l3CeBGQ6z5oOka5ecUOk+5QbmAerih6CaVsjY9BjjhiN+UOImd3xLiNeCcmLEWcXlz1Dlg==",
"dev": true,
"requires": {
"playwright-core": "1.31.2"
"playwright-core": "1.32.0"
}
},
"playwright-core": {
"version": "1.31.2",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.31.2.tgz",
"integrity": "sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ==",
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.32.0.tgz",
"integrity": "sha512-Z9Ij17X5Z3bjpp6XKujGBp9Gv4eViESac9aDmwgQFUEJBW0K80T21m/Z+XJQlu4cNsvPygw33b6V1Va6Bda5zQ==",
"dev": true
},
"plyr": {

View File

@ -62,10 +62,10 @@
"devDependencies": {
"@nextcloud/browserslist-config": "^2.3.0",
"@nextcloud/webpack-vue-config": "^5.4.0",
"@playwright/test": "^1.31.2",
"@playwright/test": "^1.32.0",
"@types/url-parse": "^1.4.8",
"@types/videojs-contrib-quality-levels": "^2.0.1",
"playwright": "^1.31.2",
"playwright": "^1.32.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"workbox-webpack-plugin": "^6.5.4"