Przeglądaj źródła

add embed/cloze/new-property tests

Tienson Qin 6 miesięcy temu
rodzic
commit
b4eb2eaf72
2 zmienionych plików z 43 dodań i 1 usunięć
  1. 1 1
      clj-e2e/dev/user.clj
  2. 42 0
      clj-e2e/test/logseq/e2e/commands_test.clj

+ 1 - 1
clj-e2e/dev/user.clj

@@ -69,7 +69,7 @@
   (repl/resume)
 
   ;; Run specific test
-  (future (run-test logseq.e2e.commands-test/template-test))
+  (future (run-test logseq.e2e.commands-test/new-property-test))
 
   ;; after the test has been paused, you can do anything with the current page like this
   (repl/with-page

+ 42 - 0
clj-e2e/test/logseq/e2e/commands_test.clj

@@ -253,3 +253,45 @@
     (let [content (w/all-text-contents ".ls-block .block-content")]
       (doseq [text ["block 1" "block 2" "block 3"]]
         (is (= 2 (count (filter #(= % text) content))))))))
+
+(deftest embed-html-test
+  (testing "embed html"
+    (b/new-block "")
+    (util/input-command "embed html")
+    (util/type "<div id=\"embed-test\">test</div>")
+    (util/exit-edit)
+    (is (= "test" (util/get-text "#embed-test")))))
+
+(deftest embed-video-test
+  (testing "embed video"
+    (b/new-block "")
+    (util/input-command "embed video")
+    (util/type "https://www.youtube.com/watch?v=7xTGNNLPyMI")
+    (util/exit-edit)
+    (w/wait-for "iframe")))
+
+(deftest embed-tweet-test
+  (testing "embed tweet"
+    (b/new-block "")
+    (util/input-command "embed tweet")
+    (util/type "https://x.com/logseq/status/1784914564083314839")
+    (util/exit-edit)
+    (w/wait-for "iframe")))
+
+(deftest cloze-test
+  (testing "cloze"
+    (b/new-block "")
+    (util/input-command "cloze")
+    (util/type "hidden answer")
+    (util/exit-edit)
+    (w/click "a.cloze")
+    (w/wait-for "a.cloze-revealed")))
+
+(deftest new-property-test
+  (testing "new property"
+    (b/new-block "")
+    (util/input-command "add new property")
+    (util/input "p1")
+    (w/click "a:has-text(\"+ New option: p1\")")
+    (k/enter)
+    (is (= "p1" (util/get-text "a.property-k")))))