user.clj 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. (ns user
  2. "fns used on repl"
  3. (:require [clojure.test :refer [run-tests run-test]]
  4. [logseq.e2e.config :as config]
  5. [logseq.e2e.editor-test]
  6. [logseq.e2e.fixtures :as fixtures]
  7. [logseq.e2e.multi-tabs-test]
  8. [logseq.e2e.outliner-test]
  9. [logseq.e2e.rtc-basic-test]
  10. [logseq.e2e.util :as util]
  11. [wally.main :as w]
  12. [wally.repl :as repl]))
  13. ;; Use port 3001 for local testing
  14. (reset! config/*port 3001)
  15. ;; show ui
  16. (reset! config/*headless false)
  17. (def *futures (atom {}))
  18. (defn cancel
  19. [test-name]
  20. (some-> (get @*futures test-name) future-cancel)
  21. (swap! *futures dissoc test-name))
  22. (defn run-editor-test
  23. []
  24. (->> (future (run-tests 'logseq.e2e.editor-test))
  25. (swap! *futures assoc :editor-test)))
  26. (defn run-outliner-test
  27. []
  28. (->> (future (run-tests 'logseq.e2e.outliner-test))
  29. (swap! *futures assoc :outliner-test)))
  30. (defn run-rtc-basic-test
  31. []
  32. (->> (future (run-tests 'logseq.e2e.rtc-basic-test))
  33. (swap! *futures assoc :rtc-basic-test)))
  34. (defn run-multi-tabs-test
  35. []
  36. (->> (future (run-tests 'logseq.e2e.multi-tabs-test))
  37. (swap! *futures assoc :multi-tabs-test)))
  38. (comment
  39. (future
  40. (fixtures/open-page
  41. repl/pause
  42. {:headless false}))
  43. ;; You can put `(repl/pause)` in any test to pause the tests,
  44. ;; this allows us to continue experimenting with the current page.
  45. (repl/pause)
  46. ;; To resume the tests, close the page/context/browser
  47. (repl/resume)
  48. ;; Run specific test
  49. (future (run-test logseq.e2e.editor-test/commands-test))
  50. ;; after the test has been paused, you can do anything with the current page like this
  51. (repl/with-page
  52. (w/wait-for (first (util/get-edit-block-container))
  53. {:state :detached}))
  54. (run-tests 'logseq.e2e.editor-test
  55. 'logseq.e2e.multi-tabs-test
  56. 'logseq.e2e.outliner-test
  57. 'logseq.e2e.rtc-basic-test)
  58. ;;
  59. )