Skip to content

Instantly share code, notes, and snippets.

@retro
Created February 17, 2016 17:14
Show Gist options
  • Save retro/60ab804165cd3c891782 to your computer and use it in GitHub Desktop.
Save retro/60ab804165cd3c891782 to your computer and use it in GitHub Desktop.
(deftest trying-to-click-non-existing-element []
(syn-run!
(<! (s/click! ".non-existing-element")) ;; Waits for the element to appear on the page up to 6 seconds
(is false "This should never run"))) ;; will never run, and test will cleanly exit
(deftest typing []
(let [[container cleanup] (container!)
bootstrap #(el! "input" container)]
(.setTimeout js/window bootstrap 2000) ;; Add the element to page after two seconds
(syn-run!
(<! (s/type! "input" "testing")) ;; Wait until the element is on the page and type into it
(is (= (dommy/value (sel1 "input")) "testing"))))) ;; Check the value of the element and assert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment