Procházet zdrojové kódy

test(e2e): fix template-test

rcmerci před 7 měsíci
rodič
revize
57f72e1526

+ 10 - 2
clj-e2e/src/logseq/e2e/util.clj

@@ -4,7 +4,8 @@
             [logseq.e2e.assert :as assert]
             [logseq.e2e.keyboard :as k]
             [wally.main :as w])
-  (:import (com.microsoft.playwright Locator$PressSequentiallyOptions)
+  (:import (com.microsoft.playwright Locator$PressSequentiallyOptions
+                                     Locator$FilterOptions)
            (com.microsoft.playwright TimeoutError)))
 
 (defn repeat-until-visible
@@ -190,7 +191,14 @@
   (press-seq " #" {:delay 20})
   (press-seq tag)
   (w/wait-for (w/find-one-by-text "a.menu-link mark" tag))
-  (k/enter))
+  (k/enter)
+  ;; wait tag added on ui
+  (assert/assert-is-visible
+   (-> (w/-query ".ls-block")
+       (.filter (.setHas (Locator$FilterOptions.)
+                         (w/-query ".editor-wrapper textarea")))
+       (.filter (.setHas (Locator$FilterOptions.)
+                         (w/-query (format ".block-tag :text('%s')" tag)))))))
 
 (defn -query-last
   [q]

+ 3 - 5
clj-e2e/test/logseq/e2e/commands_test.clj

@@ -254,11 +254,9 @@
     (util/input-command "template")
     (util/input "template 1")
     (k/enter)
-    (util/exit-edit)
-    (assert/assert-in-normal-mode?)
-    (let [content (w/all-text-contents ".ls-block")]
-      (doseq [text ["block 1" "block 2" "block 3"]]
-        (is (= 2 (count (filter #(= % text) content))))))))
+    (doseq [text ["block 1" "block 2" "block 3"]]
+      (assert/assert-have-count (.or (w/-query (format ".ls-block .block-title-wrap:text('%s')" text))
+                                     (w/-query (format ".ls-block textarea:text('%s')" text))) 2))))
 
 (deftest embed-html-test
   (testing "embed html"