mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
Add more commands e2e tests
This commit is contained in:
@@ -29,3 +29,9 @@
|
||||
[]
|
||||
;; there's some blocks visible now
|
||||
(assert-is-visible "span.block-title-wrap"))
|
||||
|
||||
(defn assert-editor-mode
|
||||
[]
|
||||
(let [klass ".editor-wrapper textarea"
|
||||
editor (w/-query klass)]
|
||||
(w/wait-for editor)))
|
||||
|
||||
@@ -13,13 +13,29 @@
|
||||
|
||||
(defn new-block
|
||||
[title]
|
||||
(k/enter)
|
||||
(util/input title))
|
||||
(let [editor? (util/get-editor)]
|
||||
(when-not editor? (open-last-block))
|
||||
(assert/assert-editor-mode)
|
||||
(k/enter)
|
||||
(util/input title)))
|
||||
|
||||
(defn save-block
|
||||
[text]
|
||||
(util/input text))
|
||||
|
||||
;; TODO: support tree
|
||||
(defn new-blocks
|
||||
[titles]
|
||||
(let [editor? (util/get-editor)]
|
||||
(when-not editor? (open-last-block))
|
||||
(assert/assert-editor-mode)
|
||||
(let [value (util/get-edit-content)]
|
||||
(if (string/blank? value) ; empty block
|
||||
(save-block (first titles))
|
||||
(new-block (first titles))))
|
||||
(doseq [title (rest titles)]
|
||||
(new-block title))))
|
||||
|
||||
(defn delete-blocks
|
||||
"Delete the current block if in editing mode, otherwise, delete all the selected blocks."
|
||||
[]
|
||||
@@ -27,19 +43,6 @@
|
||||
(when editor (util/exit-edit))
|
||||
(k/backspace)))
|
||||
|
||||
;; TODO: support tree
|
||||
(defn new-blocks
|
||||
[titles]
|
||||
(open-last-block)
|
||||
(let [value (util/get-edit-content)]
|
||||
(if (string/blank? value) ; empty block
|
||||
(do
|
||||
(save-block (first titles))
|
||||
(doseq [title (rest titles)]
|
||||
(new-block title)))
|
||||
(doseq [title titles]
|
||||
(new-block title)))))
|
||||
|
||||
(defn assert-blocks-visible
|
||||
"blocks - coll of :block/title"
|
||||
[blocks]
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
(def backspace #(press "Backspace"))
|
||||
(def tab #(press "Tab"))
|
||||
(def shift+tab #(press "Shift+Tab"))
|
||||
(def shift+enter #(press "Shift+Enter"))
|
||||
(def arrow-up #(press "ArrowUp"))
|
||||
(def arrow-down #(press "ArrowDown"))
|
||||
|
||||
@@ -161,3 +161,11 @@
|
||||
[]
|
||||
(w/refresh)
|
||||
(assert/assert-graph-loaded?))
|
||||
|
||||
(defn move-cursor-to-end
|
||||
[]
|
||||
(k/press "ControlOrMeta+a" "ArrowRight"))
|
||||
|
||||
(defn move-cursor-to-start
|
||||
[]
|
||||
(k/press "ControlOrMeta+a" "ArrowLeft"))
|
||||
|
||||
Reference in New Issue
Block a user