2023-07-07 14:34:54 +00:00
|
|
|
import { test, expect } from "@playwright/test";
|
|
|
|
import { login } from "./login";
|
|
|
|
|
|
|
|
test.describe("My resources page", () => {
|
2024-02-19 15:14:29 +00:00
|
|
|
test.describe.configure({ mode: "serial" });
|
|
|
|
|
2023-07-07 14:34:54 +00:00
|
|
|
test("List my resources", async ({ page }) => {
|
2023-08-18 12:18:28 +00:00
|
|
|
await login(page, "jdoe", "jdoe", "photoz");
|
2023-07-07 14:34:54 +00:00
|
|
|
await page.getByTestId("resources").click();
|
2023-10-17 05:42:38 +00:00
|
|
|
|
2023-07-07 14:34:54 +00:00
|
|
|
await expect(page.getByRole("gridcell", { name: "one" })).toBeVisible();
|
|
|
|
});
|
2023-10-17 05:42:38 +00:00
|
|
|
|
|
|
|
test("Nothing is shared with alice", async ({ page }) => {
|
|
|
|
await login(page, "alice", "alice", "photoz");
|
|
|
|
await page.getByTestId("resources").click();
|
|
|
|
|
|
|
|
await page.getByTestId("sharedWithMe").click();
|
|
|
|
const tableData = await page.locator("table > tr").count();
|
|
|
|
expect(tableData).toBe(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
test("Share one with alice", async ({ page }) => {
|
|
|
|
await login(page, "jdoe", "jdoe", "photoz");
|
|
|
|
await page.getByTestId("resources").click();
|
|
|
|
|
|
|
|
await page.getByTestId("expand-one").click();
|
|
|
|
await expect(page.getByText("This resource is not shared.")).toBeVisible();
|
|
|
|
|
|
|
|
await page.getByTestId("share-one").click();
|
|
|
|
await page.getByTestId("users").click();
|
|
|
|
await page.getByTestId("users").fill("alice");
|
|
|
|
await page.getByTestId("add").click();
|
|
|
|
|
|
|
|
await expect(page.getByRole("group", { name: "Share with" })).toHaveText(
|
|
|
|
"Share with alice",
|
|
|
|
);
|
|
|
|
|
2024-06-03 11:42:44 +00:00
|
|
|
await page
|
|
|
|
.getByTestId("permissions")
|
|
|
|
.getByRole("button", { expanded: false })
|
|
|
|
.click();
|
2023-10-17 05:42:38 +00:00
|
|
|
await page.getByRole("option", { name: "album:view" }).click();
|
2024-06-03 11:42:44 +00:00
|
|
|
await page
|
|
|
|
.getByTestId("permissions")
|
|
|
|
.getByRole("button", { expanded: true })
|
|
|
|
.click();
|
2023-10-17 05:42:38 +00:00
|
|
|
|
|
|
|
await page.getByTestId("done").click();
|
|
|
|
|
|
|
|
await page.getByTestId("expand-one").click();
|
2024-06-03 11:42:44 +00:00
|
|
|
await expect(page.getByTestId("shared-with-alice")).toBeVisible();
|
2023-10-17 05:42:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test("One is shared with alice", async ({ page }) => {
|
|
|
|
await login(page, "alice", "alice", "photoz");
|
|
|
|
await page.getByTestId("resources").click();
|
|
|
|
|
|
|
|
await page.getByTestId("sharedWithMe").click();
|
2024-10-11 15:32:06 +00:00
|
|
|
const rowData = page.getByTestId("row[0].name");
|
|
|
|
await expect(rowData).toHaveText("one");
|
2023-10-17 05:42:38 +00:00
|
|
|
});
|
2023-07-07 14:34:54 +00:00
|
|
|
});
|