Add test for drawing a shape in the workspace

This commit is contained in:
Belén Albeza 2024-05-09 12:57:51 +02:00
parent e28d56e670
commit 00430d63eb
4 changed files with 35 additions and 2 deletions

View file

@ -39,9 +39,11 @@ export class WorkspacePage extends BaseWebSocketPage {
constructor(page) {
super(page);
// TODO: add locators
this.pageName = page.getByTestId("page-name");
this.presentUserListItems = page.getByTestId("active-users-list").getByAltText("Princesa Leia");
this.viewport = page.getByTestId("viewport");
this.rootShape = page.locator(`[id="shape-00000000-0000-0000-0000-000000000000"]`);
this.rectShapeButton = page.getByRole("button", { name: "Rectangle (R)" });
}
async goToWorkspace() {
@ -86,4 +88,12 @@ export class WorkspacePage extends BaseWebSocketPage {
await this.mockRPC("get-file-fragment?file-id=*", "workspace/get-file-fragment-blank.json");
await this.mockRPC("get-file-libraries?file-id=*", "workspace/get-file-libraries-empty.json");
}
async clickWithDragViewportAt(x, y, width, height) {
await this.page.waitForTimeout(100);
await this.viewport.hover({ position: { x, y } });
await this.page.mouse.down();
await this.viewport.hover({ position: { x: x + width, y: y + height } });
await this.page.mouse.up();
}
}