🐛 Fix some integration tests

This commit is contained in:
Andrés Moya 2026-08-20 12:08:48 +02:00
parent 3fe06e0b5a
commit b433b52be7
15 changed files with 76 additions and 22 deletions

View File

@ -25,7 +25,7 @@
"~:revn": 11,
"~:modified-at": "~m1778577544627",
"~:vern": 151920609,
"~:id": "~u1bac06a1-a942-80a6-8008-0222e1ec38d5",
"~:id": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:is-shared": false,
"~:migrations": {
"~#ordered-set": [
@ -128,6 +128,23 @@
}
}
},
"~:tokens-status": {
"~#penpot/tokens-status": {
"~:active-theme-ids": {
"~#set": ["~uc00d9d2e-76f9-815b-8005-e1260332abac", "~uc00d9d2e-76f9-815b-8005-e1260332abb0"]
},
"~:active-set-ids": {
"~#set": [
"~u4cdd76d8-0e6d-8168-8008-01189f0ece1d",
"~u4cdd76d8-0e6d-8168-8008-01189f161e35",
"~u4cdd76d8-0e6d-8168-8008-01189f101a3f",
"~u4cdd76d8-0e6d-8168-8008-01189f0e2151",
"~u4cdd76d8-0e6d-8168-8008-01189f0cf6d3",
"~u4cdd76d8-0e6d-8168-8008-01189f0e7da8"
]
}
}
},
"~:tokens-lib": {
"~#penpot/tokens-lib": {
"~:sets": {
@ -4312,7 +4329,7 @@
}
}
},
"~:id": "~u1bac06a1-a942-80a6-8008-0222e1ec38d5",
"~:id": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:options": {
"~:components-v2": true,
"~:base-font-size": "16px"

View File

@ -5771,6 +5771,16 @@
},
"~:id": "~u7b2da435-6186-815a-8007-0daa95d2f26d",
"~:options": { "~:components-v2": true, "~:base-font-size": "16px" },
"~:tokens-status": {
"~#penpot/tokens-status": {
"~:active-theme-ids": {
"~#set": []
},
"~:active-set-ids": {
"~#set": ["~u5403f14e-eb02-80be-8007-0494f09cefca"]
}
}
},
"~:tokens-lib": {
"~#penpot/tokens-lib": {
"~:sets": {

View File

@ -29,7 +29,7 @@
"~:revn": 36,
"~:modified-at": "~m1776760054954",
"~:vern": 0,
"~:id": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:id": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:is-shared": false,
"~:migrations": {
"~#ordered-set": [
@ -423,7 +423,7 @@
"~:key": "wgjr6b27pa",
"~:font-size": "16",
"~:font-weight": "400",
"~:typography-ref-file": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:typography-ref-file": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:modified-at": "~m1776759448186",
"~:font-variant-id": "regular",
"~:text-decoration": "none",
@ -445,7 +445,7 @@
"~:key": "1dpjnycmsmq",
"~:font-size": "16",
"~:font-weight": "400",
"~:typography-ref-file": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:typography-ref-file": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:text-direction": "ltr",
"~:type": "paragraph",
"~:modified-at": "~m1776759448186",
@ -1079,7 +1079,7 @@
"~:key": "wgjr6b27pa",
"~:font-size": "18",
"~:font-weight": "700",
"~:typography-ref-file": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:typography-ref-file": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:modified-at": "~m1776759420985",
"~:font-variant-id": "700",
"~:text-decoration": "none",
@ -1101,7 +1101,7 @@
"~:key": "1dpjnycmsmq",
"~:font-size": "18",
"~:font-weight": "700",
"~:typography-ref-file": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:typography-ref-file": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:text-direction": "ltr",
"~:type": "paragraph",
"~:modified-at": "~m1776759420985",
@ -1517,7 +1517,7 @@
"~:name": "Page 1"
}
},
"~:id": "~u1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
"~:id": "~uc7ce0794-0992-8105-8004-38f280443849",
"~:options": {
"~:components-v2": true,
"~:base-font-size": "16px"
@ -1554,6 +1554,18 @@
"~:font-family": "IM Fell French Canon SC"
}
},
"~:tokens-status": {
"~#penpot/tokens-status": {
"~:active-theme-ids": {
"~#set": []
},
"~:active-set-ids": {
"~#set": [
"~u12f7a4ff-ddae-80ff-8007-e70bba7e2db2"
]
}
}
},
"~:tokens-lib": {
"~#penpot/tokens-lib": {
"~:sets": {

View File

@ -31,6 +31,7 @@ test("User adds a library and its automatically selected in the color palette",
// Now the get-file call should return a library
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json");
await workspacePage.openLibrariesModal();
await workspacePage.librariesModal.getByRole("tab", { name: "Libraries" }).click();
await workspacePage.clickLibrary("Testing library 1");
await workspacePage.closeLibrariesModal();
@ -40,6 +41,7 @@ test("User adds a library and its automatically selected in the color palette",
// Remove Testing library 1
await workspacePage.openLibrariesModal();
await workspacePage.librariesModal.getByRole("tab", { name: "This file" }).click();
await workspacePage.clickLibrary("Testing library 1");
await workspacePage.closeLibrariesModal();

View File

@ -152,6 +152,7 @@ test("[Taiga #10630] [INSPECT] Style assets not being displayed on info tab", as
await workspacePage.clickAssets();
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json");
await workspacePage.openLibrariesModal();
await workspacePage.librariesModal.getByRole("tab", { name: "Libraries" }).click();
await workspacePage.clickLibrary("Testing library 1");
await workspacePage.closeLibrariesModal();

View File

@ -210,7 +210,7 @@ test("Multiselection of text and typographies", async ({ page }) => {
);
await workspacePage.goToWorkspace({
fileId: "1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
fileId: "c7ce0794-0992-8105-8004-38f280443849",
pageId: "1062e0a0-8fe0-80ae-8007-e70b4993f5f0",
});

View File

@ -89,6 +89,12 @@ test.describe("Tokens Themes", () => {
tokenThemeUpdateCreateModal.getByText("Changed" + "4 active sets"),
).toBeVisible();
await tokenThemeUpdateCreateModal
.getByRole("switch", {
name: "Changed",
})
.click();
await tokenThemeUpdateCreateModal
.getByRole("button")
.getByText("close")

View File

@ -143,6 +143,10 @@ test("BUG 14214 - Updates tab refreshes after syncing a freshly linked library",
// 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();

View File

@ -25,7 +25,7 @@ import { WasmWorkspacePage } from "../pages/WasmWorkspacePage";
// ---------------------------------------------------------------------------
const FILE_A = {
id: "1062e0a0-8fe0-80ae-8007-e70b4993f5ef",
id: "c7ce0794-0992-8105-8004-38f280443849",
pageId: "1062e0a0-8fe0-80ae-8007-e70b4993f5f0",
// "Text with typography asset one" carries a ref to in-file typography whose
// font-family is "IM Fell French Canon SC" (multiselection-typography.json).

View File

@ -315,6 +315,7 @@ test("User adds a library and its automatically selected in the color palette",
// Now the get-file call should return a library
await workspacePage.mockRPC(/get\-file\?/, "workspace/get-file-library.json");
await workspacePage.openLibrariesModal();
await workspacePage.librariesModal.getByRole("tab", { name: "Libraries" }).click();
await workspacePage.clickLibrary("Testing library 1");
await workspacePage.closeLibrariesModal();

View File

@ -9,6 +9,7 @@
[app.common.data.macros :as dm]
[app.common.files.changes-builder :as pcb]
[app.common.files.helpers :as cfh]
[app.common.files.tokens :as cfo]
[app.common.geom.point :as gpt]
[app.common.logic.tokens :as clo]
[app.common.path-names :as cpn]
@ -415,9 +416,11 @@
ptk/WatchEvent
(watch [it state _]
(let [data (dsh/lookup-file-data state)
status (cfo/make-tokens-status-from-lib lib)
changes (-> (pcb/empty-changes it)
(pcb/with-library-data data)
(pcb/set-tokens-lib lib))]
(pcb/set-tokens-lib lib)
(pcb/set-tokens-status status))]
(rx/of (dch/commit-changes changes)
(dwtp/propagate-workspace-tokens))))))

View File

@ -506,7 +506,7 @@
(def workspace-token-sets-tree
(l/derived (d/nilf ctob/get-set-tree) tokens-lib))
(def workspace-active-theme-paths
(def workspace-active-theme-ids
(l/derived (d/nilf ctos/get-active-theme-ids) tokens-status))
(def workspace-all-tokens-map
@ -521,9 +521,6 @@
(cfo/sets-at-path-all-active? status @(l/derived identity tokens-lib) group-path)))
tokens-status))
(def workspace-active-theme-paths-no-hidden
workspace-active-theme-paths)
;; FIXME: deprecated, it should not be implemented with ref (still used in form)
(def workspace-active-theme-sets-tokens
(l/derived (fn [[status lib]]

View File

@ -113,7 +113,7 @@
tokens-lib (mf/deref refs/tokens-lib)
tokens-status (mf/deref refs/tokens-status)
active-themes (mf/deref refs/workspace-active-theme-paths)
active-themes (mf/deref refs/workspace-active-theme-ids)
active-sets (mf/with-memo [tokens-status tokens-lib]
(when (and tokens-status tokens-lib)
(cfo/get-active-sets tokens-status tokens-lib)))

View File

@ -67,7 +67,7 @@
(mf/defc themes-overview
[{:keys [change-view]}]
(let [active-theme-paths (mf/deref refs/workspace-active-theme-paths)
(let [active-theme-ids (mf/deref refs/workspace-active-theme-ids)
themes-groups (mf/deref refs/workspace-token-theme-tree-no-hidden)
create-theme
@ -96,7 +96,7 @@
[:ul {:class (stl/css :theme-group-rows-wrapper)}
(for [[_ {:keys [id name] :as theme}] themes
:let [theme-path (ctob/get-theme-path theme)
selected? (some? (get active-theme-paths theme-path))
selected? (some? (get active-theme-ids (ctob/get-id theme)))
delete-theme
(fn [e]
(dom/prevent-default e)
@ -325,9 +325,10 @@
on-toggle-token-set
(mf/use-fn
(mf/deps current-theme)
(fn [set-name]
(swap! current-theme* #(ctob/toggle-set % set-name))))
(mf/deps current-theme tokens-lib)
(fn [set-id]
(let [set (ctob/get-set tokens-lib set-id)]
(swap! current-theme* #(ctob/toggle-set % (ctob/get-name set))))))
on-toggle-token-set-group
(mf/use-fn

View File

@ -674,7 +674,7 @@
;; requested. Enabling only adds the set name to the hidden theme,
;; so it does not depend on the create event having propagated yet.
(when active?
(st/emit! (dwtl/set-enabled-token-set (ctob/get-name set) true)))
(st/emit! (dwtl/set-enabled-token-set (ctob/get-id set) true)))
;; Pass the set name as `initial-name` so the proxy can resolve
;; it immediately, before the async `st/emit!` above propagates
;; the new set into `@st/state`.