diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fc6e871a2c..a67d4a5449 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,8 +8,6 @@ on: pull_request: types: - opened - - edited - - reopened - synchronize push: branches: @@ -91,6 +89,30 @@ jobs: run: | yarn run lint:scss; + test-render-wasm: + name: "Render WASM Tests" + runs-on: ubuntu-24.04 + container: penpotapp/devenv:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Format + working-directory: ./render-wasm + run: | + cargo fmt --check + + - name: Lint + working-directory: ./render-wasm + run: | + ./lint + + - name: Test + working-directory: ./render-wasm + run: | + ./test + test-backend: name: "Backend Tests" runs-on: ubuntu-24.04 diff --git a/backend/resources/app/email/feedback/en.txt b/backend/resources/app/email/feedback/en.txt index 76a42e42cf..7427ef0de0 100644 --- a/backend/resources/app/email/feedback/en.txt +++ b/backend/resources/app/email/feedback/en.txt @@ -1,7 +1,8 @@ From: {{profile.fullname}} <{{profile.email}}> / {{profile.id}} Subject: {{feedback-subject}} Type: {{feedback-type}} -{%- if feedback-error-href %} + +{% if feedback-error-href %} HREF: {{feedback-error-href}} {% endif -%} diff --git a/backend/src/app/loggers/audit/archive_task.clj b/backend/src/app/loggers/audit/archive_task.clj index c8aa0e0de9..4eb87d595e 100644 --- a/backend/src/app/loggers/audit/archive_task.clj +++ b/backend/src/app/loggers/audit/archive_task.clj @@ -57,7 +57,7 @@ :uid uuid/zero}) body (t/encode {:events events}) headers {"content-type" "application/transit+json" - "origin" (cf/get :public-uri) + "origin" (str (cf/get :public-uri)) "cookie" (u/map->query-string {:auth-token token})} params {:uri uri :timeout 12000 diff --git a/backend/src/app/util/template.clj b/backend/src/app/util/template.clj index b781fc194a..5c7a0b8c6e 100644 --- a/backend/src/app/util/template.clj +++ b/backend/src/app/util/template.clj @@ -9,7 +9,7 @@ [app.common.exceptions :as ex] [selmer.parser :as sp])) -(sp/cache-off!) +;; (sp/cache-off!) (defn render [path context] diff --git a/backend/test/backend_tests/storage_test.clj b/backend/test/backend_tests/storage_test.clj index 1377dc4f39..a387074c4c 100644 --- a/backend/test/backend_tests/storage_test.clj +++ b/backend/test/backend_tests/storage_test.clj @@ -318,3 +318,35 @@ ;; check that we have all no objects (let [rows (th/db-exec! ["select * from storage_object where deleted_at is null"])] (t/is (= 0 (count rows)))))) + +(t/deftest tempfile-bucket-test + (let [storage (-> (:app.storage/storage th/*system*) + (configure-storage-backend)) + content1 (sto/content "content1") + now (ct/now) + + object1 (sto/put-object! storage {::sto/content content1 + ::sto/touched-at (ct/plus now {:minutes 1}) + :bucket "tempfile" + :content-type "text/plain"})] + + + (binding [ct/*clock* (clock/fixed now)] + (let [res (th/run-task! :storage-gc-touched {})] + (t/is (= 0 (:freeze res))) + (t/is (= 0 (:delete res))))) + + + (binding [ct/*clock* (clock/fixed (ct/plus now {:minutes 1}))] + (let [res (th/run-task! :storage-gc-touched {})] + (t/is (= 0 (:freeze res))) + (t/is (= 1 (:delete res))))) + + + (binding [ct/*clock* (clock/fixed (ct/plus now {:hours 1}))] + (let [res (th/run-task! :storage-gc-deleted {})] + (t/is (= 0 (:deleted res))))) + + (binding [ct/*clock* (clock/fixed (ct/plus now {:hours 2}))] + (let [res (th/run-task! :storage-gc-deleted {})] + (t/is (= 0 (:deleted res))))))) diff --git a/common/deps.edn b/common/deps.edn index dcdf4fe0a8..a2d9a1b1ec 100644 --- a/common/deps.edn +++ b/common/deps.edn @@ -17,7 +17,7 @@ org.slf4j/slf4j-api {:mvn/version "2.0.17"} pl.tkowalcz.tjahzi/log4j2-appender {:mvn/version "0.9.40"} - selmer/selmer {:mvn/version "1.12.62"} + selmer/selmer {:mvn/version "1.12.69"} criterium/criterium {:mvn/version "0.4.6"} metosin/jsonista {:mvn/version "0.3.13"} @@ -48,12 +48,8 @@ com.sun.mail/jakarta.mail {:mvn/version "2.0.2"} org.la4j/la4j {:mvn/version "0.6.0"} - ;; exception printing - fipp/fipp {:mvn/version "0.6.29"} - me.flowthing/pp {:mvn/version "2024-11-13.77"} - io.aviso/pretty {:mvn/version "1.4.4"} environ/environ {:mvn/version "1.2.0"}} :paths ["src" "vendor" "target/classes"] diff --git a/common/src/app/common/data/macros.cljc b/common/src/app/common/data/macros.cljc index e0096b21cc..dc23426a95 100644 --- a/common/src/app/common/data/macros.cljc +++ b/common/src/app/common/data/macros.cljc @@ -9,10 +9,10 @@ (:refer-clojure :exclude [get-in select-keys str with-open max]) #?(:cljs (:require-macros [app.common.data.macros])) (:require + #?(:clj [cljs.analyzer.api :as aapi]) #?(:clj [clojure.core :as c] :cljs [cljs.core :as c]) [app.common.data :as d] - [cljs.analyzer.api :as aapi] [cuerdas.core :as str])) (defmacro select-keys @@ -44,42 +44,43 @@ [& params] `(str/concat ~@params)) -(defmacro export - "A helper macro that allows reexport a var in a current namespace." - [v] - (if (boolean (:ns &env)) +#?(:clj + (defmacro export + "A helper macro that allows reexport a var in a current namespace." + [v] + (if (boolean (:ns &env)) - ;; Code for ClojureScript - (let [mdata (aapi/resolve &env v) - arglists (second (get-in mdata [:meta :arglists])) - sym (symbol (c/name v)) - andsym (symbol "&") - procarg #(if (= % andsym) % (gensym "param"))] - (if (pos? (count arglists)) - `(def - ~(with-meta sym (:meta mdata)) - (fn ~@(for [args arglists] - (let [args (map procarg args)] - (if (some #(= andsym %) args) - (let [[sargs dargs] (split-with #(not= andsym %) args)] - `([~@sargs ~@dargs] (apply ~v ~@sargs ~@(rest dargs)))) - `([~@args] (~v ~@args))))))) - `(def ~(with-meta sym (:meta mdata)) ~v))) + ;; Code for ClojureScript + (let [mdata (aapi/resolve &env v) + arglists (second (get-in mdata [:meta :arglists])) + sym (symbol (c/name v)) + andsym (symbol "&") + procarg #(if (= % andsym) % (gensym "param"))] + (if (pos? (count arglists)) + `(def + ~(with-meta sym (:meta mdata)) + (fn ~@(for [args arglists] + (let [args (map procarg args)] + (if (some #(= andsym %) args) + (let [[sargs dargs] (split-with #(not= andsym %) args)] + `([~@sargs ~@dargs] (apply ~v ~@sargs ~@(rest dargs)))) + `([~@args] (~v ~@args))))))) + `(def ~(with-meta sym (:meta mdata)) ~v))) - ;; Code for Clojure - (let [vr (resolve v) - m (meta vr) - n (:name m) - n (with-meta n - (cond-> {} - (:dynamic m) (assoc :dynamic true) - (:protocol m) (assoc :protocol (:protocol m))))] - `(let [m# (meta ~vr)] - (def ~n (deref ~vr)) - (alter-meta! (var ~n) merge (dissoc m# :name)) - ;; (when (:macro m#) - ;; (.setMacro (var ~n))) - ~vr)))) + ;; Code for Clojure + (let [vr (resolve v) + m (meta vr) + n (:name m) + n (with-meta n + (cond-> {} + (:dynamic m) (assoc :dynamic true) + (:protocol m) (assoc :protocol (:protocol m))))] + `(let [m# (meta ~vr)] + (def ~n (deref ~vr)) + (alter-meta! (var ~n) merge (dissoc m# :name)) + ;; (when (:macro m#) + ;; (.setMacro (var ~n))) + ~vr))))) (defmacro fmt "String interpolation helper. Can only be used with strings known at diff --git a/docs/img/variants/07-variants-boolean.webp b/docs/img/variants/07-variants-boolean.webp new file mode 100644 index 0000000000..894c5f45db Binary files /dev/null and b/docs/img/variants/07-variants-boolean.webp differ diff --git a/docs/user-guide/design-systems/variants.njk b/docs/user-guide/design-systems/variants.njk index bba1cc96f0..5b41f0fade 100644 --- a/docs/user-guide/design-systems/variants.njk +++ b/docs/user-guide/design-systems/variants.njk @@ -107,6 +107,25 @@ desc: Streamline your design workflow with Penpot's Components guide! Learn to c
When a variant property represents a boolean state, Penpot can display it as a toggle instead of a dropdown. This offers a quicker and more visual way to switch between two opposite values when working with copies.
+The toggle appears in place of the property values dropdown, only when a copy is selected.
+
+For Penpot to recognize the property as a boolean and display the toggle, the property must be defined with exactly two opposing values. These can be any of the following pairs:
+true / falseon / offyes / noThe order of the values does not matter. Penpot automatically maps them to ON and OFF states:
+true, yes, onfalse, no, offOnce you have created your variants, you can place a copy of a component with variants into your design and then switch between its different versions.
diff --git a/frontend/package.json b/frontend/package.json index 6eb48efa4a..9ac5975668 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -47,7 +47,7 @@ "watch:app:libs": "node ./scripts/build-libs.js --watch", "watch:app:main": "clojure -M:dev:shadow-cljs watch main storybook", "clear:shadow-cache": "rm -rf .shadow-cljs", - "watch:app": "yarn run clear:shadow-cache && concurrently \"yarn run build:app:worker\" \"yarn run watch:app:main\" \"yarn run watch:app:libs\"", + "watch:app": "yarn run clear:shadow-cache && yarn run build:app:worker && concurrently \"yarn run watch:app:main\" \"yarn run watch:app:libs\"", "watch": "yarn run watch:app:assets", "watch:storybook": "yarn run build:storybook:assets && concurrently \"storybook dev -p 6006 --no-open\" \"yarn run watch:storybook:assets\"", "watch:storybook:assets": "node ./scripts/watch-storybook.js" diff --git a/frontend/playwright/data/render-wasm/get-file-frame-nested-clipping.json b/frontend/playwright/data/render-wasm/get-file-frame-nested-clipping.json new file mode 100644 index 0000000000..1a4d016d8f --- /dev/null +++ b/frontend/playwright/data/render-wasm/get-file-frame-nested-clipping.json @@ -0,0 +1,1089 @@ +{ + "~:features": { + "~#set": [ + "fdata/path-data", + "plugins/runtime", + "design-tokens/v1", + "variants/v1", + "layout/grid", + "styles/v2", + "fdata/pointer-map", + "fdata/objects-map", + "render-wasm/v1", + "components/v2", + "fdata/shape-data-type" + ] + }, + "~:team-id": "~ueba8fa2e-4140-8084-8005-448635d7a724", + "~:permissions": { + "~:type": "~:membership", + "~:is-owner": true, + "~:is-admin": true, + "~:can-edit": true, + "~:can-read": true, + "~:is-logged": true + }, + "~:has-media-trimmed": false, + "~:comment-thread-seqn": 0, + "~:name": "Nested clipping", + "~:revn": 44, + "~:modified-at": "~m1764151542189", + "~:vern": 0, + "~:id": "~u44471494-966a-8178-8006-c5bd93f0fe72", + "~:is-shared": false, + "~:migrations": { + "~#ordered-set": [ + "legacy-2", + "legacy-3", + "legacy-5", + "legacy-6", + "legacy-7", + "legacy-8", + "legacy-9", + "legacy-10", + "legacy-11", + "legacy-12", + "legacy-13", + "legacy-14", + "legacy-16", + "legacy-17", + "legacy-18", + "legacy-19", + "legacy-25", + "legacy-26", + "legacy-27", + "legacy-28", + "legacy-29", + "legacy-31", + "legacy-32", + "legacy-33", + "legacy-34", + "legacy-36", + "legacy-37", + "legacy-38", + "legacy-39", + "legacy-40", + "legacy-41", + "legacy-42", + "legacy-43", + "legacy-44", + "legacy-45", + "legacy-46", + "legacy-47", + "legacy-48", + "legacy-49", + "legacy-50", + "legacy-51", + "legacy-52", + "legacy-53", + "legacy-54", + "legacy-55", + "legacy-56", + "legacy-57", + "legacy-59", + "legacy-62", + "legacy-65", + "legacy-66", + "legacy-67", + "0001-remove-tokens-from-groups", + "0002-normalize-bool-content-v2", + "0002-clean-shape-interactions", + "0003-fix-root-shape", + "0003-convert-path-content-v2", + "0005-deprecate-image-type", + "0006-fix-old-texts-fills", + "0008-fix-library-colors-v4", + "0009-clean-library-colors", + "0009-add-partial-text-touched-flags", + "0010-fix-swap-slots-pointing-non-existent-shapes", + "0011-fix-invalid-text-touched-flags", + "0012-fix-position-data", + "0013-fix-component-path", + "0013-clear-invalid-strokes-and-fills", + "0014-fix-tokens-lib-duplicate-ids", + "0014-clear-components-nil-objects", + "0015-fix-text-attrs-blank-strings", + "0015-clean-shadow-color", + "0016-copy-fills-from-position-data-to-text-node" + ] + }, + "~:version": 67, + "~:project-id": "~ueba8fa2e-4140-8084-8005-448635da32b4", + "~:created-at": "~m1764144613130", + "~:backend": "legacy-db", + "~:data": { + "~:pages": [ + "~u44471494-966a-8178-8006-c5bd93f0fe73" + ], + "~:pages-index": { + "~u44471494-966a-8178-8006-c5bd93f0fe73": { + "~:objects": { + "~u00000000-0000-0000-0000-000000000000": { + "~#shape": { + "~:y": 0, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:name": "Root Frame", + "~:width": 0.01, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 0, + "~:y": 0 + } + }, + { + "~#point": { + "~:x": 0.01, + "~:y": 0 + } + }, + { + "~#point": { + "~:x": 0.01, + "~:y": 0.01 + } + }, + { + "~#point": { + "~:x": 0, + "~:y": 0.01 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:r1": 0, + "~:id": "~u00000000-0000-0000-0000-000000000000", + "~:parent-id": "~u00000000-0000-0000-0000-000000000000", + "~:frame-id": "~u00000000-0000-0000-0000-000000000000", + "~:strokes": [], + "~:x": 0, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 0, + "~:y": 0, + "~:width": 0.01, + "~:height": 0.01, + "~:x1": 0, + "~:y1": 0, + "~:x2": 0.01, + "~:y2": 0.01 + } + }, + "~:fills": [ + { + "~:fill-color": "#FFFFFF", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 0.01, + "~:flip-y": null, + "~:shapes": [ + "~u571478fd-6386-8085-8007-2b11cd2fc79a", + "~u1a629c22-3d11-80b1-8007-2b2bf3d82765", + "~u1a629c22-3d11-80b1-8007-2b2c061d3786" + ] + } + }, + "~u571478fd-6386-8085-8007-2b11c3aa600f": { + "~#shape": { + "~:y": 440, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Rectangle", + "~:width": 456, + "~:type": "~:rect", + "~:points": [ + { + "~#point": { + "~:x": 669, + "~:y": 440 + } + }, + { + "~#point": { + "~:x": 1125, + "~:y": 440 + } + }, + { + "~#point": { + "~:x": 1125, + "~:y": 609 + } + }, + { + "~#point": { + "~:x": 669, + "~:y": 609 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u571478fd-6386-8085-8007-2b11c3aa600f", + "~:parent-id": "~u571478fd-6386-8085-8007-2b11bf4e9c11", + "~:frame-id": "~u571478fd-6386-8085-8007-2b11bf4e9c11", + "~:strokes": [], + "~:x": 669, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 669, + "~:y": 440, + "~:width": 456, + "~:height": 169, + "~:x1": 669, + "~:y1": 440, + "~:x2": 1125, + "~:y2": 609 + } + }, + "~:fills": [ + { + "~:fill-color": "#B1B2B5", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 169, + "~:flip-y": null + } + }, + "~u571478fd-6386-8085-8007-2b11cd2fc79a": { + "~#shape": { + "~:y": 204, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Board", + "~:width": 535, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 333, + "~:y": 204 + } + }, + { + "~#point": { + "~:x": 868, + "~:y": 204 + } + }, + { + "~#point": { + "~:x": 868, + "~:y": 851 + } + }, + { + "~#point": { + "~:x": 333, + "~:y": 851 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:r1": 0, + "~:id": "~u571478fd-6386-8085-8007-2b11cd2fc79a", + "~:parent-id": "~u00000000-0000-0000-0000-000000000000", + "~:frame-id": "~u00000000-0000-0000-0000-000000000000", + "~:strokes": [], + "~:x": 333, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 333, + "~:y": 204, + "~:width": 535, + "~:height": 647, + "~:x1": 333, + "~:y1": 204, + "~:x2": 868, + "~:y2": 851 + } + }, + "~:fills": [ + { + "~:fill-color": "#FFFFFF", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 647, + "~:flip-y": null, + "~:shapes": [ + "~u571478fd-6386-8085-8007-2b11bf4e9c11" + ] + } + }, + "~u1a629c22-3d11-80b1-8007-2b2c061d3788": { + "~#shape": { + "~:y": 1173, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Rectangle", + "~:width": 456, + "~:type": "~:rect", + "~:points": [ + { + "~#point": { + "~:x": 1254, + "~:y": 1173 + } + }, + { + "~#point": { + "~:x": 1710, + "~:y": 1173 + } + }, + { + "~#point": { + "~:x": 1710, + "~:y": 1342 + } + }, + { + "~#point": { + "~:x": 1254, + "~:y": 1342 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c061d3788", + "~:parent-id": "~u1a629c22-3d11-80b1-8007-2b2c061d3787", + "~:frame-id": "~u1a629c22-3d11-80b1-8007-2b2c061d3787", + "~:strokes": [], + "~:x": 1254, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 1254, + "~:y": 1173, + "~:width": 456, + "~:height": 169, + "~:x1": 1254, + "~:y1": 1173, + "~:x2": 1710, + "~:y2": 1342 + } + }, + "~:fills": [ + { + "~:fill-color": "#B1B2B5", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 169, + "~:flip-y": null + } + }, + "~u1a629c22-3d11-80b1-8007-2b2c061d3787": { + "~#shape": { + "~:y": 1042, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": true, + "~:name": "Board", + "~:width": 518, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 1106, + "~:y": 1042 + } + }, + { + "~#point": { + "~:x": 1624, + "~:y": 1042 + } + }, + { + "~#point": { + "~:x": 1624, + "~:y": 1466 + } + }, + { + "~#point": { + "~:x": 1106, + "~:y": 1466 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c061d3787", + "~:parent-id": "~u1a629c22-3d11-80b1-8007-2b2c061d3786", + "~:frame-id": "~u1a629c22-3d11-80b1-8007-2b2c061d3786", + "~:strokes": [], + "~:x": 1106, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 1106, + "~:y": 1042, + "~:width": 518, + "~:height": 424, + "~:x1": 1106, + "~:y1": 1042, + "~:x2": 1624, + "~:y2": 1466 + } + }, + "~:fills": [ + { + "~:fill-color": "#dc0606", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 424, + "~:flip-y": null, + "~:shapes": [ + "~u1a629c22-3d11-80b1-8007-2b2c061d3788" + ] + } + }, + "~u571478fd-6386-8085-8007-2b11bf4e9c11": { + "~#shape": { + "~:y": 309, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": true, + "~:name": "Board", + "~:width": 518, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 521, + "~:y": 309 + } + }, + { + "~#point": { + "~:x": 1039, + "~:y": 309 + } + }, + { + "~#point": { + "~:x": 1039, + "~:y": 733 + } + }, + { + "~#point": { + "~:x": 521, + "~:y": 733 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u571478fd-6386-8085-8007-2b11bf4e9c11", + "~:parent-id": "~u571478fd-6386-8085-8007-2b11cd2fc79a", + "~:frame-id": "~u571478fd-6386-8085-8007-2b11cd2fc79a", + "~:strokes": [], + "~:x": 521, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 521, + "~:y": 309, + "~:width": 518, + "~:height": 424, + "~:x1": 521, + "~:y1": 309, + "~:x2": 1039, + "~:y2": 733 + } + }, + "~:fills": [ + { + "~:fill-color": "#dc0606", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 424, + "~:flip-y": null, + "~:shapes": [ + "~u571478fd-6386-8085-8007-2b11c3aa600f" + ] + } + }, + "~u1a629c22-3d11-80b1-8007-2b2c061d3786": { + "~#shape": { + "~:y": 937, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Board", + "~:width": 535, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 918, + "~:y": 937 + } + }, + { + "~#point": { + "~:x": 1453, + "~:y": 937 + } + }, + { + "~#point": { + "~:x": 1453, + "~:y": 1584 + } + }, + { + "~#point": { + "~:x": 918, + "~:y": 1584 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:blur": { + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c031523df", + "~:type": "~:layer-blur", + "~:value": 4, + "~:hidden": false + }, + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c061d3786", + "~:parent-id": "~u00000000-0000-0000-0000-000000000000", + "~:frame-id": "~u00000000-0000-0000-0000-000000000000", + "~:strokes": [], + "~:x": 918, + "~:proportion": 1, + "~:shadow": [ + { + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c0899422b", + "~:style": "~:drop-shadow", + "~:color": { + "~:color": "#000000", + "~:opacity": 1 + }, + "~:offset-x": 40, + "~:offset-y": 40, + "~:blur": 4, + "~:spread": 0, + "~:hidden": false + } + ], + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 918, + "~:y": 937, + "~:width": 535, + "~:height": 647, + "~:x1": 918, + "~:y1": 937, + "~:x2": 1453, + "~:y2": 1584 + } + }, + "~:fills": [ + { + "~:fill-color": "#FFFFFF", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 647, + "~:flip-y": null, + "~:shapes": [ + "~u1a629c22-3d11-80b1-8007-2b2c061d3787" + ] + } + }, + "~u1a629c22-3d11-80b1-8007-2b2bf3d82765": { + "~#shape": { + "~:y": 937, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Board", + "~:width": 535, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 333, + "~:y": 937 + } + }, + { + "~#point": { + "~:x": 868, + "~:y": 937 + } + }, + { + "~#point": { + "~:x": 868, + "~:y": 1584 + } + }, + { + "~#point": { + "~:x": 333, + "~:y": 1584 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:blur": { + "~:id": "~u1a629c22-3d11-80b1-8007-2b2c031523df", + "~:type": "~:layer-blur", + "~:value": 4, + "~:hidden": false + }, + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82765", + "~:parent-id": "~u00000000-0000-0000-0000-000000000000", + "~:frame-id": "~u00000000-0000-0000-0000-000000000000", + "~:strokes": [], + "~:x": 333, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 333, + "~:y": 937, + "~:width": 535, + "~:height": 647, + "~:x1": 333, + "~:y1": 937, + "~:x2": 868, + "~:y2": 1584 + } + }, + "~:fills": [ + { + "~:fill-color": "#FFFFFF", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 647, + "~:flip-y": null, + "~:shapes": [ + "~u1a629c22-3d11-80b1-8007-2b2bf3d82766" + ] + } + }, + "~u1a629c22-3d11-80b1-8007-2b2bf3d82766": { + "~#shape": { + "~:y": 1042, + "~:hide-fill-on-export": false, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": true, + "~:name": "Board", + "~:width": 518, + "~:type": "~:frame", + "~:points": [ + { + "~#point": { + "~:x": 521, + "~:y": 1042 + } + }, + { + "~#point": { + "~:x": 1039, + "~:y": 1042 + } + }, + { + "~#point": { + "~:x": 1039, + "~:y": 1466 + } + }, + { + "~#point": { + "~:x": 521, + "~:y": 1466 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82766", + "~:parent-id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82765", + "~:frame-id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82765", + "~:strokes": [], + "~:x": 521, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 521, + "~:y": 1042, + "~:width": 518, + "~:height": 424, + "~:x1": 521, + "~:y1": 1042, + "~:x2": 1039, + "~:y2": 1466 + } + }, + "~:fills": [ + { + "~:fill-color": "#dc0606", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 424, + "~:flip-y": null, + "~:shapes": [ + "~u1a629c22-3d11-80b1-8007-2b2bf3d82767" + ] + } + }, + "~u1a629c22-3d11-80b1-8007-2b2bf3d82767": { + "~#shape": { + "~:y": 1173, + "~:transform": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:rotation": 0, + "~:grow-type": "~:fixed", + "~:hide-in-viewer": false, + "~:name": "Rectangle", + "~:width": 456, + "~:type": "~:rect", + "~:points": [ + { + "~#point": { + "~:x": 669, + "~:y": 1173 + } + }, + { + "~#point": { + "~:x": 1125, + "~:y": 1173 + } + }, + { + "~#point": { + "~:x": 1125, + "~:y": 1342 + } + }, + { + "~#point": { + "~:x": 669, + "~:y": 1342 + } + } + ], + "~:r2": 0, + "~:proportion-lock": false, + "~:transform-inverse": { + "~#matrix": { + "~:a": 1, + "~:b": 0, + "~:c": 0, + "~:d": 1, + "~:e": 0, + "~:f": 0 + } + }, + "~:r3": 0, + "~:constraints-v": "~:top", + "~:constraints-h": "~:left", + "~:r1": 0, + "~:id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82767", + "~:parent-id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82766", + "~:frame-id": "~u1a629c22-3d11-80b1-8007-2b2bf3d82766", + "~:strokes": [], + "~:x": 669, + "~:proportion": 1, + "~:r4": 0, + "~:selrect": { + "~#rect": { + "~:x": 669, + "~:y": 1173, + "~:width": 456, + "~:height": 169, + "~:x1": 669, + "~:y1": 1173, + "~:x2": 1125, + "~:y2": 1342 + } + }, + "~:fills": [ + { + "~:fill-color": "#B1B2B5", + "~:fill-opacity": 1 + } + ], + "~:flip-x": null, + "~:height": 169, + "~:flip-y": null + } + } + }, + "~:id": "~u1dc9717a-2217-80f7-8007-2b11bac2823f", + "~:name": "Page 1" + } + }, + "~:id": "~u44471494-966a-8178-8006-c5bd93f0fe72", + "~:options": { + "~:components-v2": true, + "~:base-font-size": "16px" + } + } + } \ No newline at end of file diff --git a/frontend/playwright/ui/pages/WasmWorkspacePage.js b/frontend/playwright/ui/pages/WasmWorkspacePage.js index 851bb8af49..d594232c47 100644 --- a/frontend/playwright/ui/pages/WasmWorkspacePage.js +++ b/frontend/playwright/ui/pages/WasmWorkspacePage.js @@ -42,7 +42,7 @@ export class WasmWorkspacePage extends WorkspacePage { } async waitForFirstRenderWithoutUI() { - await waitForFirstRender(); + await this.waitForFirstRender(); await this.hideUI(); } diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js index f1d9b46dd8..040cf66953 100644 --- a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js +++ b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js @@ -258,6 +258,22 @@ test("Renders a file with nested frames with inherited blur", async ({ await expect(workspace.canvas).toHaveScreenshot(); }); +test("Renders a file with nested clipping frames", async ({ page }) => { + const workspace = new WasmWorkspacePage(page); + await workspace.setupEmptyFile(); + await workspace.mockGetFile( + "render-wasm/get-file-frame-nested-clipping.json", + ); + + await workspace.goToWorkspace({ + id: "44471494-966a-8178-8006-c5bd93f0fe72", + pageId: "44471494-966a-8178-8006-c5bd93f0fe73", + }); + await workspace.waitForFirstRenderWithoutUI(); + + await expect(workspace.canvas).toHaveScreenshot(); +}); + test("Renders a clipped frame with a large blur drop shadow", async ({ page, }) => { diff --git a/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-nested-clipping-frames-1.png b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-nested-clipping-frames-1.png new file mode 100644 index 0000000000..5d41d8eb51 Binary files /dev/null and b/frontend/playwright/ui/render-wasm-specs/shapes.spec.js-snapshots/Renders-a-file-with-nested-clipping-frames-1.png differ diff --git a/frontend/playwright/ui/specs/subscriptions-dashboard.spec.js b/frontend/playwright/ui/specs/subscriptions-dashboard.spec.js index 7945d87cb4..15f312bbd5 100644 --- a/frontend/playwright/ui/specs/subscriptions-dashboard.spec.js +++ b/frontend/playwright/ui/specs/subscriptions-dashboard.spec.js @@ -9,403 +9,399 @@ test.beforeEach(async ({ page }) => { ]); }); -test.describe("Subscriptions: dashboard", () => { - test("Team with unlimited subscription has specific icon in menu", async ({ +test("Team with unlimited subscription has specific icon in menu", async ({ + page, +}) => { + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-subscription.json", - ); + "get-profile", + "subscription/get-profile-unlimited-subscription.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await DashboardPage.mockRPC( - page, - "get-projects?team-id=*", - "dashboard/get-projects-second-team.json", - ); - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - await dashboardPage.goToSecondTeamDashboard(); - await expect(page.getByTestId("subscription-icon")).toBeVisible(); - }); - - test("The Unlimited subscription has its name in the sidebar dropdown", async ({ + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-subscription.json", - ); + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage-one-editor.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - await dashboardPage.goToDashboard(); - - await expect(page.getByTestId("subscription-name")).toHaveText( - "Unlimited plan (trial)", - ); - }); - - test("When the subscription status is unpaid, the sidebar dropdown displays the name Professional for the Unlimited subscription", async ({ + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-unpaid-subscription.json", - ); + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - await dashboardPage.goToDashboard(); - - await expect(page.getByTestId("subscription-name")).toHaveText( - "Professional plan", - ); - }); - - test("When the subscription status is canceled, the sidebar dropdown displays the name Professional for the Enterprise subscription", async ({ + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-enterprise-canceled-subscription.json", - ); + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - await dashboardPage.goToDashboard(); - - await expect(page.getByTestId("subscription-name")).toHaveText( - "Professional plan", - ); - }); + await DashboardPage.mockRPC( + page, + "get-projects?team-id=*", + "dashboard/get-projects-second-team.json", + ); + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + await dashboardPage.goToSecondTeamDashboard(); + await expect(page.getByTestId("subscription-icon")).toBeVisible(); }); -test.describe("Subscriptions: team members and invitations", () => { - test("Team settings has susbscription name and no manage subscription link when is member", async ({ +test("The Unlimited subscription has its name in the sidebar dropdown", async ({ + page, +}) => { + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "logged-in-user/get-profile-logged-in.json", - ); + "get-profile", + "subscription/get-profile-unlimited-subscription.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-member.json", - ); - - await DashboardPage.mockRPC( - page, - "get-projects?team-id=*", - "dashboard/get-projects-second-team.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-members?team-id=*", - "subscription/get-team-members-subscription-member.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-stats?team-id=*", - "dashboard/get-team-stats.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - - await dashboardPage.goToSecondTeamSettingsSection(); - await expect(page.getByText("Unlimited (trial)")).toBeVisible(); - await expect( - page.getByRole("button", { name: "Manage your subscription" }), - ).not.toBeVisible(); - }); - - test("Team settings has susbscription name and manage subscription link when is owner", async ({ + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-subscription.json", - ); + "get-subscription-usage", + "subscription/get-subscription-usage-one-editor.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await DashboardPage.mockRPC( - page, - "get-projects?team-id=*", - "dashboard/get-projects-second-team.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-members?team-id=*", - "subscription/get-team-members-subscription-owner.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-stats?team-id=*", - "dashboard/get-team-stats.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - - await dashboardPage.goToSecondTeamSettingsSection(); - - await expect(page.getByText("Unlimited (trial)")).toBeVisible(); - await expect( - page.getByRole("button", { name: "Manage your subscription" }), - ).toBeVisible(); - }); - - test("Members tab has warning message when user has more seats than editors.", async ({ + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-subscription.json", - ); + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await DashboardPage.mockRPC( - page, - "get-projects?team-id=*", - "dashboard/get-projects-second-team.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-members?team-id=*", - "subscription/get-team-members-subscription-eight-member.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - - await dashboardPage.goToSecondTeamMembersSection(); - - const ctas = page.getByTestId("cta"); - await expect(ctas).toHaveCount(2); - await expect( - page.getByText("Inviting people while on the unlimited plan"), - ).toBeVisible(); - }); - - test("Invitations tab has warning message when user has more seats than editors.", async ({ + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( page, - }) => { - await DashboardPage.mockRPC( - page, - "get-profile", - "subscription/get-profile-unlimited-subscription.json", - ); + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); - await DashboardPage.mockRPC( - page, - "get-subscription-usage", - "subscription/get-subscription-usage.json", - ); + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + await dashboardPage.goToDashboard(); - await DashboardPage.mockRPC( - page, - "get-team-info", - "subscription/get-team-info-subscriptions.json", - ); - - const dashboardPage = new DashboardPage(page); - await dashboardPage.setupDashboardFull(); - await DashboardPage.mockRPC( - page, - "get-teams", - "subscription/get-teams-unlimited-subscription-owner.json", - ); - - await DashboardPage.mockRPC( - page, - "get-projects?team-id=*", - "dashboard/get-projects-second-team.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-members?team-id=*", - "subscription/get-team-members-subscription-eight-member.json", - ); - - await DashboardPage.mockRPC( - page, - "get-team-invitations?team-id=*", - "subscription/get-team-invitations.json", - ); - - await dashboardPage.mockRPC( - "push-audit-events", - "workspace/audit-event-empty.json", - ); - - await dashboardPage.goToSecondTeamInvitationsSection(); - - const ctas = page.getByTestId("cta"); - await expect(ctas).toHaveCount(2); - await expect( - page.getByText("Inviting people while on the unlimited plan"), - ).toBeVisible(); - }); + await expect(page.getByTestId("subscription-name")).toHaveText( + "Unlimited plan (trial)", + ); +}); + +test("The sidebar dropdown displays the correct subscription name when status is Unpaid", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "subscription/get-profile-unlimited-unpaid-subscription.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + await dashboardPage.goToDashboard(); + + await expect(page.getByTestId("subscription-name")).toHaveText( + "Professional plan", + ); +}); + +test("The sidebar dropdown displays the correct subscription name when status is cancelled", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "subscription/get-profile-enterprise-canceled-subscription.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + await dashboardPage.goToDashboard(); + + await expect(page.getByTestId("subscription-name")).toHaveText( + "Professional plan", + ); +}); + +test("Team settings has susbscription name and no manage subscription link when is member", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "logged-in-user/get-profile-logged-in.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-member.json", + ); + + await DashboardPage.mockRPC( + page, + "get-projects?team-id=*", + "dashboard/get-projects-second-team.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-members?team-id=*", + "subscription/get-team-members-subscription-member.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-stats?team-id=*", + "dashboard/get-team-stats.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + + await dashboardPage.goToSecondTeamSettingsSection(); + await expect(page.getByText("Unlimited (trial)")).toBeVisible(); + await expect( + page.getByRole("button", { name: "Manage your subscription" }), + ).not.toBeVisible(); +}); + +test("Team settings has susbscription name and manage subscription link when is owner", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "subscription/get-profile-unlimited-subscription.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); + + await DashboardPage.mockRPC( + page, + "get-projects?team-id=*", + "dashboard/get-projects-second-team.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-members?team-id=*", + "subscription/get-team-members-subscription-owner.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-stats?team-id=*", + "dashboard/get-team-stats.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + + await dashboardPage.goToSecondTeamSettingsSection(); + + await expect(page.getByText("Unlimited (trial)")).toBeVisible(); + await expect( + page.getByRole("button", { name: "Manage your subscription" }), + ).toBeVisible(); +}); + +test("Members tab has warning message when user has more seats than editors", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "subscription/get-profile-unlimited-subscription.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); + + await DashboardPage.mockRPC( + page, + "get-projects?team-id=*", + "dashboard/get-projects-second-team.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-members?team-id=*", + "subscription/get-team-members-subscription-eight-member.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + + await dashboardPage.goToSecondTeamMembersSection(); + + const ctas = page.getByTestId("cta"); + await expect(ctas).toHaveCount(2); + await expect( + page.getByText("Inviting people while on the unlimited plan"), + ).toBeVisible(); +}); + +test("Invitations tab has warning message when user has more seats than editors", async ({ + page, +}) => { + await DashboardPage.mockRPC( + page, + "get-profile", + "subscription/get-profile-unlimited-subscription.json", + ); + + await DashboardPage.mockRPC( + page, + "get-subscription-usage", + "subscription/get-subscription-usage.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-info", + "subscription/get-team-info-subscriptions.json", + ); + + const dashboardPage = new DashboardPage(page); + await dashboardPage.setupDashboardFull(); + await DashboardPage.mockRPC( + page, + "get-teams", + "subscription/get-teams-unlimited-subscription-owner.json", + ); + + await DashboardPage.mockRPC( + page, + "get-projects?team-id=*", + "dashboard/get-projects-second-team.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-members?team-id=*", + "subscription/get-team-members-subscription-eight-member.json", + ); + + await DashboardPage.mockRPC( + page, + "get-team-invitations?team-id=*", + "subscription/get-team-invitations.json", + ); + + await dashboardPage.mockRPC( + "push-audit-events", + "workspace/audit-event-empty.json", + ); + + await dashboardPage.goToSecondTeamInvitationsSection(); + + const ctas = page.getByTestId("cta"); + await expect(ctas).toHaveCount(2); + await expect( + page.getByText("Inviting people while on the unlimited plan"), + ).toBeVisible(); }); diff --git a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs index 517ce5bff8..4862b5a7e6 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/v2_editor.cljs @@ -317,7 +317,7 @@ max-height (max height selrect-height) valign (-> shape :content :vertical-align) y (:y selrect) - y (if (> height selrect-height) + y (if (and valign (> height selrect-height)) (case valign "bottom" (- y (- height selrect-height)) "center" (- y (/ (- height selrect-height) 2)) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/bool.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/bool.cljs index 4c1fb0d1b7..7181bf9d36 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/bool.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/bool.cljs @@ -38,30 +38,18 @@ (features/use-feature "render-wasm/v1") has-invalid-shapes? - (if render-wasm-enabled? - false - (some (fn [shape] - (or (cfh/frame-shape? shape) - (cfh/text-shape? shape))) - shapes-with-children)) + (some (if render-wasm-enabled? + cfh/frame-shape? + #(or (cfh/frame-shape? %) (cfh/text-shape? %))) + shapes-with-children) head-not-group-like? (and (= 1 total-selected) (not is-group?) (not is-bool?)) - disabled-bool-btns - (if render-wasm-enabled? - false - (or (zero? total-selected) - has-invalid-shapes? - head-not-group-like?)) - - disabled-flatten - (if render-wasm-enabled? - false - (or (zero? total-selected) - has-invalid-shapes?)) + disabled-bool-btns (or (zero? total-selected) has-invalid-shapes? head-not-group-like?) + disabled-flatten (or (zero? total-selected) has-invalid-shapes?) on-change (mf/use-fn diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index ba5525791e..8e6f8f0e14 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -475,9 +475,9 @@ (dissoc :style) (merge style) (select-keys allowed-keys)) - fill-rule (or (-> attrs :fill-rule sr/translate-fill-rule) (-> attrs :fillRule sr/translate-fill-rule)) - stroke-linecap (or (-> attrs :stroke-linecap sr/translate-stroke-linecap) (-> attrs :strokeLinecap sr/translate-stroke-linecap)) - stroke-linejoin (or (-> attrs :stroke-linejoin sr/translate-stroke-linejoin) (-> attrs :strokeLinejoin sr/translate-stroke-linejoin)) + fill-rule (-> (or (:fill-rule attrs) (:fillRule attrs)) sr/translate-fill-rule) + stroke-linecap (-> (or (:stroke-linecap attrs) (:strokeLinecap attrs)) sr/translate-stroke-linecap) + stroke-linejoin (-> (or (:stroke-linejoin attrs) (:strokeLinejoin attrs)) sr/translate-stroke-linejoin) fill-none (= "none" (-> attrs :fill))] (h/call wasm/internal-module "_set_shape_svg_attrs" fill-rule stroke-linecap stroke-linejoin fill-none))) diff --git a/frontend/src/app/util/clipboard.js b/frontend/src/app/util/clipboard.js index 96f4080a7e..0322829e41 100644 --- a/frontend/src/app/util/clipboard.js +++ b/frontend/src/app/util/clipboard.js @@ -67,15 +67,17 @@ function filterAllowedTypes(options) { * @param {string} type * @returns {boolean} */ - return function filter(type) { + function filter(type) { if ( (!("allowHTMLPaste" in options) || !options["allowHTMLPaste"]) && - type === "text/html" + type === "text/html" ) { return false; } return allowedTypes.includes(type); }; + + return filter; } /** @@ -85,19 +87,22 @@ function filterAllowedTypes(options) { * @returns {Function