test(e2e,rtc): fix new-block to make it work correctly in rtc env

This commit is contained in:
rcmerci
2025-05-28 17:53:13 +08:00
parent 4f6c0fee28
commit 900efe1076
2 changed files with 13 additions and 8 deletions

View File

@@ -16,7 +16,8 @@
[logseq.e2e.property-basic-test]
[logseq.e2e.util :as util]
[wally.main :as w]
[wally.repl :as repl]))
[wally.repl :as repl]
[logseq.e2e.locator :as loc]))
;; Use port 3001 for local testing
(reset! config/*port 3001)

View File

@@ -22,14 +22,18 @@
(defn new-block
[title]
(let [editor (util/get-editor)
blocks-count (util/blocks-count)]
(let [editor (util/get-editor)]
(when-not editor (open-last-block))
(assert/assert-editor-mode)
(k/enter)
(assert/assert-have-count ".ls-block" (inc blocks-count))
(assert/assert-editor-mode)
(save-block title)))
(let [last-id (.getAttribute (w/-query ".editor-wrapper textarea") "id")]
(is (some? last-id))
(k/enter)
(assert/assert-is-visible
(loc/filter ".editor-wrapper"
:has "textarea"
:has-not (str "#" last-id)))
(assert/assert-editor-mode)
(save-block title))))
;; TODO: support tree
(defn new-blocks
@@ -38,7 +42,7 @@
(when-not editor? (open-last-block))
(assert/assert-editor-mode)
(let [value (util/get-edit-content)]
(if (string/blank? value) ; empty block
(if (string/blank? value) ; empty block
(save-block (first titles))
(new-block (first titles))))
(doseq [title (rest titles)]