Browse Source

test(e2e): fix util/get-editor

rcmerci 5 months ago
parent
commit
7e2c9e8cc9
2 changed files with 6 additions and 7 deletions
  1. 2 7
      clj-e2e/src/logseq/e2e/block.clj
  2. 4 0
      clj-e2e/src/logseq/e2e/util.clj

+ 2 - 7
clj-e2e/src/logseq/e2e/block.clj

@@ -21,13 +21,8 @@
         blocks-count (util/blocks-count)]
     (when-not editor (open-last-block))
     (assert/assert-editor-mode)
-    (try
-      (k/enter)
-      (assert/assert-have-count ".ls-block" (inc blocks-count))
-      (catch org.opentest4j.AssertionFailedError _e
-        ;; retry once
-        (k/enter)
-        (assert/assert-have-count ".ls-block" (inc blocks-count))))
+    (k/enter)
+    (assert/assert-have-count ".ls-block" (inc blocks-count))
     (assert/assert-editor-mode)
     (save-block title)))
 

+ 4 - 0
clj-e2e/src/logseq/e2e/util.clj

@@ -39,6 +39,10 @@
   []
   (let [editor (w/-query editor-q)]
     (when (w/visible? editor-q)
+      ;; ensure cursor exists
+      ;; Sometimes when the editor exists, there isn't a blinking cursor,
+      ;; causing subsequent operations (like pressing Enter) to fail.
+      (w/click editor)
       editor)))
 
 (defn get-edit-block-container