mirror of
https://github.com/penpot/penpot.git
synced 2026-11-17 07:30:35 +00:00
Changing the library in the Swap component menu cleared the search field, so checking several connected libraries for the same component meant typing the name again for each one. Keep the term and reset only the library id and the group path, so the new library is shown already filtered. Closes #12335 AI-assisted-by: claude-opus-5-5 Signed-off-by: JiMyung Lee <lee.ji.myung@gmail.com>
224 lines
6.8 KiB
JavaScript
224 lines
6.8 KiB
JavaScript
import { test, expect } from "@playwright/test";
|
|
import { WasmWorkspacePage } from "../pages/WasmWorkspacePage";
|
|
|
|
const mainFileId = "3622460c-3408-81e2-8005-2fd0e55888b7";
|
|
const sharedFileId = "3622460c-3408-81e2-8005-2fc938010233";
|
|
|
|
const mainPageId = "3622460c-3408-81e2-8005-2fd0e55888b8";
|
|
|
|
const mainFileFragmentId1 = "6777aca0-5737-8169-8005-33b1ab0bcf8a";
|
|
const mainFileFragmentId2 = "6777aca0-5737-8169-8005-33b3eb8de897";
|
|
|
|
const sharedFileFragmentId1 = "3622460c-3408-81e2-8005-31859c15ff91";
|
|
const sharedFileFragmentId2 = "3622460c-3408-81e2-8005-31859c15ff90";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await WasmWorkspacePage.init(page);
|
|
});
|
|
|
|
// Fix for https://tree.taiga.io/project/penpot/issue/9042
|
|
test("Bug 9056 - 'More info' doesn't open the update tab", async ({ page }) => {
|
|
const workspacePage = new WasmWorkspacePage(page);
|
|
await workspacePage.setupEmptyFile(page);
|
|
|
|
await workspacePage.mockRPC(
|
|
/get\-file\?id=3622460c-3408-81e2-8005-2fd0e55888b7/,
|
|
"workspace/get-file-9056_main.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
/get\-file\?id=3622460c-3408-81e2-8005-2fc938010233/,
|
|
"workspace/get-file-9056_shared.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
"get-file-libraries?file-id=*",
|
|
"workspace/get-file-libraries-9056.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
`get-file-fragment?file-id=${mainFileId}&fragment-id=${mainFileFragmentId1}`,
|
|
"workspace/get-file-fragment-9056_main-1.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
`get-file-fragment?file-id=${mainFileId}&fragment-id=${mainFileFragmentId2}`,
|
|
"workspace/get-file-fragment-9056_main-2.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
`get-file-fragment?file-id=${sharedFileId}&fragment-id=${sharedFileFragmentId1}`,
|
|
"workspace/get-file-fragment-9056_shared-1.json",
|
|
);
|
|
|
|
await workspacePage.mockRPC(
|
|
`get-file-fragment?file-id=${sharedFileId}&fragment-id=${sharedFileFragmentId2}`,
|
|
"workspace/get-file-fragment-9056_shared-2.json",
|
|
);
|
|
|
|
await workspacePage.goToWorkspace({
|
|
fileId: mainFileId,
|
|
pageId: mainPageId,
|
|
});
|
|
|
|
await workspacePage.mockRPC(
|
|
"get-team-shared-files?team-id=*",
|
|
"workspace/get-team-shared-files-9056.json",
|
|
);
|
|
|
|
await page.getByRole("button", { name: "More info" }).click();
|
|
|
|
await expect(page.getByRole("tabpanel", { name: "UPDATES" })).toHaveText(
|
|
/library updates/i,
|
|
);
|
|
});
|
|
|
|
test("Bug 10113 - Empty library modal for non-empty library", async ({
|
|
page,
|
|
}) => {
|
|
const workspace = new WasmWorkspacePage(page);
|
|
|
|
await workspace.setupEmptyFile(page);
|
|
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-10113.json");
|
|
await workspace.mockRPC(
|
|
"get-file-fragment?file-id=*&fragment-id=*",
|
|
"workspace/get-file-fragment-10113.json",
|
|
);
|
|
await workspace.mockRPC(/get\-file\?/, "workspace/get-file-10113.json");
|
|
await workspace.mockRPC(
|
|
"get-team-shared-files?team-id=*",
|
|
"workspace/get-team-shared-files-empty.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
"set-file-shared",
|
|
"workspace/set-file-shared-10113.json",
|
|
);
|
|
|
|
await workspace.goToWorkspace({
|
|
fileId: "5b7ebd2b-2907-80db-8005-b9d67c20cf2e",
|
|
pageId: "5b7ebd2b-2907-80db-8005-b9d67c20cf2f",
|
|
});
|
|
|
|
await workspace.clickAssets();
|
|
await workspace.openLibrariesModal();
|
|
|
|
await workspace.librariesModal
|
|
.getByRole("button", { name: "Publish" })
|
|
.click();
|
|
|
|
await expect(
|
|
workspace.page.getByText("Publish empty library"),
|
|
).not.toBeVisible();
|
|
});
|
|
|
|
test("BUG 14214 - Updates tab refreshes after syncing a freshly linked library", async ({
|
|
page,
|
|
}) => {
|
|
const workspace = new WasmWorkspacePage(page);
|
|
await workspace.setupEmptyFile(page);
|
|
|
|
await workspace.mockRPC(
|
|
new RegExp(`get\\-file\\?id=${mainFileId}`),
|
|
"workspace/get-file-14214_main.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
new RegExp(`get\\-file\\?id=${sharedFileId}`),
|
|
"workspace/get-file-14214_shared.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
"get-file-libraries?file-id=*",
|
|
"workspace/get-file-libraries-14214.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
"get-team-shared-files?team-id=*",
|
|
"workspace/get-team-shared-files-14214.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
"link-file-to-library",
|
|
"workspace/link-file-to-library.json",
|
|
);
|
|
|
|
await workspace.goToWorkspace({ fileId: mainFileId, pageId: mainPageId });
|
|
|
|
// Open the library modal
|
|
await workspace.clickAssets();
|
|
await workspace.openLibrariesModal();
|
|
|
|
// Switch to the Libraries tab
|
|
await workspace.librariesModal.getByRole("tab", { name: "Libraries" }).click();
|
|
|
|
await workspace.librariesModal
|
|
.getByRole("button", { name: "Connect library" })
|
|
.click();
|
|
|
|
// Switch to the Updates tab — the library should appear as needing update.
|
|
await workspace.librariesModal.getByRole("tab", { name: "Updates" }).click();
|
|
|
|
const updatesPanel = workspace.librariesModal.getByRole("tabpanel", {
|
|
name: "UPDATES",
|
|
});
|
|
await updatesPanel.getByRole("button", { name: "Update" }).click();
|
|
await expect(
|
|
updatesPanel.getByText("There are no Shared Libraries that need update"),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("Swap component menu keeps the search when changing library", async ({
|
|
page,
|
|
}) => {
|
|
const workspace = new WasmWorkspacePage(page);
|
|
await workspace.setupEmptyFile(page);
|
|
|
|
await workspace.mockRPC(
|
|
/get\-file\?/,
|
|
"workspace/get-file-9066-swap-groups.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
new RegExp(`get\\-file\\?id=${sharedFileId}`),
|
|
"workspace/get-file-9056_shared.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
"get-file-libraries?file-id=*",
|
|
"workspace/get-file-libraries-9056.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
`get-file-fragment?file-id=${sharedFileId}&fragment-id=${sharedFileFragmentId1}`,
|
|
"workspace/get-file-fragment-9056_shared-1.json",
|
|
);
|
|
await workspace.mockRPC(
|
|
`get-file-fragment?file-id=${sharedFileId}&fragment-id=${sharedFileFragmentId2}`,
|
|
"workspace/get-file-fragment-9056_shared-2.json",
|
|
);
|
|
|
|
await workspace.goToWorkspace({
|
|
fileId: "e179d9df-de35-80bf-8005-283bbd5516b0",
|
|
pageId: "e179d9df-de35-80bf-8005-283bbd5516b1",
|
|
});
|
|
|
|
await workspace.clickToggableLayer("Board");
|
|
await workspace.clickToggableLayer("Group");
|
|
await workspace.layers.getByText("A", { exact: true }).click();
|
|
await workspace.rightSidebar.getByRole("button", { name: /^A / }).click();
|
|
|
|
const search = workspace.rightSidebar.locator(
|
|
"#swap-component-search-filter",
|
|
);
|
|
await search.fill("rect");
|
|
await expect(
|
|
workspace.rightSidebar.getByText("There are no assets in this library yet"),
|
|
).toBeVisible();
|
|
|
|
await workspace.rightSidebar
|
|
.getByRole("combobox")
|
|
.filter({ hasText: "New File 10" })
|
|
.click();
|
|
await workspace.rightSidebar
|
|
.getByRole("option", { name: "published component" })
|
|
.click();
|
|
|
|
await expect(search).toHaveValue("rect");
|
|
await expect(
|
|
workspace.rightSidebar.getByText("Rectangle", { exact: true }),
|
|
).toBeVisible();
|
|
});
|