🐛 Fix problem moving layout to frame

This commit is contained in:
alonso.torres 2024-06-10 16:03:07 +02:00
parent 8825e9f80b
commit f88bb4e204
9 changed files with 492 additions and 16 deletions

View file

@ -102,6 +102,13 @@ export class WorkspacePage extends BaseWebSocketPage {
await this.page.mouse.up();
}
async moveSelectionToShape(name) {
await this.page.locator('rect.viewport-selrect').hover();
await this.page.mouse.down();
await this.viewport.getByTestId(name).first().hover({ force: true });
await this.page.mouse.up();
}
async clickLeafLayer(name, clickOptions = {}) {
const layer = this.layers.getByText(name);
await layer.click(clickOptions);

View file

@ -44,3 +44,35 @@ test.describe("Constraints", () => {
expect(false);
});
});
test("BUG 7760 - Layout losing properties when changing parents", async ({ page }) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.setupEmptyFile();
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-7760.json");
await workspacePage.mockRPC(
"get-file-fragment?file-id=*&fragment-id=*",
"workspace/get-file-fragment-7760.json",
);
await workspacePage.mockRPC("update-file?id=*", "workspace/update-file-create-rect.json");
await workspacePage.goToWorkspace({
fileId: "cd90e028-326a-80b4-8004-7cdec16ffad5",
pageId: "cd90e028-326a-80b4-8004-7cdec16ffad6",
});
// Select the flex board and drag it into the other container board
await workspacePage.clickLeafLayer("Flex Board");
// Move the first board into the second
const hAuto = await workspacePage.page.getByTitle("Fit content (Horizontal)");
const vAuto = await workspacePage.page.getByTitle("Fit content (Vertical)");
await expect(vAuto.locator("input")).toBeChecked();
await expect(hAuto.locator("input")).toBeChecked();
await workspacePage.moveSelectionToShape("Container Board");
// The first board properties should still be auto width/height
await expect(vAuto.locator("input")).toBeChecked();
await expect(hAuto.locator("input")).toBeChecked();
});

View file

@ -67,7 +67,6 @@ test("User adds a library and its automatically selected in the color palette",
await expect(workspacePage.palette.getByText('There are no color styles in your library yet')).toBeVisible();
});
test("User makes a group", async ({ page }) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.setupEmptyFile();