2024-05-07 13:12:58 +02:00
|
|
|
import { test, expect } from "@playwright/test";
|
2024-05-08 14:22:18 +02:00
|
|
|
import { WorkspacePage } from "../pages/WorkspacePage";
|
2024-05-07 13:12:58 +02:00
|
|
|
import { presenceFixture } from "../../data/workspace/ws-notifications";
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
2024-05-08 14:22:18 +02:00
|
|
|
await WorkspacePage.init(page);
|
2024-05-07 13:12:58 +02:00
|
|
|
});
|
|
|
|
|
2024-05-14 15:13:11 +02:00
|
|
|
test("User loads worskpace with empty file", async ({ page }) => {
|
2024-05-08 14:22:18 +02:00
|
|
|
const workspacePage = new WorkspacePage(page);
|
|
|
|
await workspacePage.setupEmptyFile(page);
|
2024-05-07 13:12:58 +02:00
|
|
|
|
2024-05-08 14:22:18 +02:00
|
|
|
await workspacePage.goToWorkspace();
|
2024-05-07 13:12:58 +02:00
|
|
|
|
2024-05-08 14:22:18 +02:00
|
|
|
await expect(workspacePage.pageName).toHaveText("Page 1");
|
2024-05-07 13:12:58 +02:00
|
|
|
});
|
|
|
|
|
2024-05-14 15:13:11 +02:00
|
|
|
test("User receives presence notifications updates in the workspace", async ({ page }) => {
|
2024-05-08 14:22:18 +02:00
|
|
|
const workspacePage = new WorkspacePage(page);
|
|
|
|
await workspacePage.setupEmptyFile();
|
|
|
|
|
|
|
|
await workspacePage.goToWorkspace();
|
|
|
|
await workspacePage.sendPresenceMessage(presenceFixture);
|
2024-05-07 13:12:58 +02:00
|
|
|
|
|
|
|
await expect(page.getByTestId("active-users-list").getByAltText("Princesa Leia")).toHaveCount(2);
|
|
|
|
});
|
2024-05-09 12:57:51 +02:00
|
|
|
|
2024-05-14 15:13:11 +02:00
|
|
|
test("User draws a rect", async ({ page }) => {
|
2024-05-09 12:57:51 +02:00
|
|
|
const workspacePage = new WorkspacePage(page);
|
|
|
|
await workspacePage.setupEmptyFile();
|
|
|
|
await workspacePage.mockRPC("update-file?id=*", "workspace/update-file-create-rect.json");
|
|
|
|
|
|
|
|
await workspacePage.goToWorkspace();
|
|
|
|
await workspacePage.rectShapeButton.click();
|
|
|
|
await workspacePage.clickWithDragViewportAt(128, 128, 200, 100);
|
|
|
|
|
|
|
|
const shape = await workspacePage.rootShape.locator("rect");
|
2024-05-13 17:17:16 +02:00
|
|
|
await expect(shape).toHaveAttribute("width", "200");
|
|
|
|
await expect(shape).toHaveAttribute("height", "100");
|
2024-05-09 12:57:51 +02:00
|
|
|
});
|
2024-06-06 12:28:41 +02:00
|
|
|
|
2024-06-11 09:59:35 +02:00
|
|
|
test("User makes a group", async ({ page }) => {
|
|
|
|
const workspacePage = new WorkspacePage(page);
|
|
|
|
await workspacePage.setupEmptyFile();
|
|
|
|
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-not-empty.json");
|
|
|
|
await workspacePage.mockRPC("update-file?id=*", "workspace/update-file-create-rect.json");
|
|
|
|
|
2024-06-11 15:43:28 +02:00
|
|
|
await workspacePage.goToWorkspace({
|
|
|
|
fileId: "6191cd35-bb1f-81f7-8004-7cc63d087374",
|
|
|
|
pageId: "6191cd35-bb1f-81f7-8004-7cc63d087375",
|
2024-06-11 09:59:35 +02:00
|
|
|
});
|
|
|
|
await workspacePage.clickLeafLayer("Rectangle");
|
|
|
|
await workspacePage.page.keyboard.press("ControlOrMeta+g");
|
|
|
|
await workspacePage.expectSelectedLayer("Group");
|
|
|
|
});
|