Przeglądaj źródła

feat(test): add template-basic e2e-test

rcmerci 4 lat temu
rodzic
commit
d9bd7d08b3
1 zmienionych plików z 44 dodań i 0 usunięć
  1. 44 0
      cypress/integration/app/template.cljs

+ 44 - 0
cypress/integration/app/template.cljs

@@ -0,0 +1,44 @@
+(ns app.template
+  "Template related operations"
+  (:require-macros [latte.core :refer [describe beforeEach before it]])
+  (:require [latte.chai :refer (expect)]
+            [app.util :as util])
+  (:refer-clojure :exclude [first get]))
+
+(def cy js/cy)
+
+(describe "template"
+          (beforeEach []
+                      (.clearIndexedDB cy)
+                      (cy.wait 1000))
+          (before []
+                  (.visit cy "http://localhost:3001"))
+          (it "template-basic" []
+              (.. cy
+                  (get "#search-field")
+                  (click)
+                  (type "template test page")
+                  (wait 1000)
+                  (type "{enter}"))
+              (util/edit-block "template")
+              (.. cy
+                  (realPress #js ["Shift" "Enter"]))
+              (util/edit-block "template:: template-name{enter}")
+              (util/tab)
+              (util/edit-block "line1{enter}")
+              (util/edit-block "line2{enter}")
+              (util/tab)
+              (util/edit-block "line3")
+              (.. cy
+                  (get ".ls-block")
+                  (should (fn [result]
+                            (expect result :to.have.length 4))))
+              (dorun (repeatedly 3 #(util/edit-block "{enter}")))
+
+              (util/edit-block "/template{enter}")
+              (util/edit-block "template-name{enter}")
+              (cy.wait 1000)
+              (.. cy
+                  (get ".ls-block")
+                  (should (fn [result]
+                            (expect result :to.have.length 8))))))