basic.cljs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. (ns app.basic
  2. "Basic operations"
  3. (:require-macros [latte.core :refer [describe beforeEach before it]])
  4. (:require [latte.chai :refer (expect)]
  5. [app.util :as util])
  6. (:refer-clojure :exclude [first get]))
  7. (def cy js/cy)
  8. (describe "basic"
  9. (beforeEach []
  10. (.clearIndexedDB cy))
  11. (before []
  12. (.. cy
  13. (visit "http://localhost:3001")
  14. (get "#main-content-container" #js {:timeout 10000})
  15. (should (fn [result]
  16. (expect result :not.to.contain "Loading")))))
  17. (it "Search" []
  18. (.. cy
  19. (get "#search-button")
  20. (click)
  21. (get "input.cp__palette-input")
  22. (type "welcome to Logseq"))
  23. (.. cy (get "#ui__ac-inner")
  24. (should (fn [result]
  25. (expect result :to.have.length 1))))
  26. (util/back-to-home)
  27. ;; create new page
  28. (.. cy
  29. (get "#search-button")
  30. (click)
  31. (get "input.cp__palette-input")
  32. (type "new page")
  33. (wait 500)
  34. (type "{enter}"))
  35. ;; edit bullet
  36. (util/edit-block "this is my first bullet {enter}")
  37. (util/edit-block "this is my second bullet {enter}")
  38. (util/edit-block "this is my third bullet")
  39. (util/tab)
  40. (util/edit-block ", continue editing")
  41. (util/shift+tab)
  42. (util/edit-block ", continue {enter}")
  43. ;; Backspace to delete a block
  44. (util/edit-block "test")
  45. ;; delete the previous block
  46. (dorun (repeatedly 5 util/backspace))
  47. (.. cy (get ".ls-block")
  48. (should (fn [result]
  49. (expect result :to.have.length 3))))
  50. (util/edit-block "{enter}")
  51. ;; Del
  52. (util/edit-block "test")
  53. (util/edit-block "{leftarrow}{leftarrow}")
  54. (util/delete)
  55. (util/delete)
  56. ;; FIXME: not working
  57. ;; (match-content "te")
  58. (util/edit-block "{enter}")
  59. ;; Selection
  60. (dorun (repeatedly 3 util/shift+up))))