basic.cljs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. (.visit cy "http://localhost:3001"))
  13. (it "Search" []
  14. (.. cy
  15. (get "#search-button")
  16. (click)
  17. (type "welcome to Logseq"))
  18. (.. cy (get "#ui__ac-inner")
  19. (should (fn [result]
  20. (expect result :to.have.length 1))))
  21. (util/back-to-home)
  22. ;; create new page
  23. (.. cy
  24. (get "#search-button")
  25. (click)
  26. (type "new page"))
  27. (.wait cy 1000)
  28. (.. cy
  29. (get "#search-button")
  30. (type "{enter}"))
  31. ;; edit bullet
  32. (util/edit-block "this is my first bullet {enter}")
  33. (util/edit-block "this is my second bullet {enter}")
  34. (util/edit-block "this is my third bullet")
  35. (util/tab)
  36. (util/edit-block ", continue editing")
  37. (util/shift+tab)
  38. (util/edit-block ", continue {enter}")
  39. ;; Backspace to delete a block
  40. (util/edit-block "test")
  41. ;; delete the previous block
  42. (dorun (repeatedly 5 util/backspace))
  43. (.. cy (get ".ls-block")
  44. (should (fn [result]
  45. (expect result :to.have.length 3))))
  46. (util/edit-block "{enter}")
  47. ;; Del
  48. (util/edit-block "test")
  49. (util/edit-block "{leftarrow}{leftarrow}")
  50. (util/delete)
  51. (util/delete)
  52. ;; FIXME: not working
  53. ;; (match-content "te")
  54. (util/edit-block "{enter}")
  55. ;; Selection
  56. (dorun (repeatedly 3 util/shift+up))))