Skip to content

Commit

Permalink
fix: check no errors are logged on e2e
Browse files Browse the repository at this point in the history
Fix #26
  • Loading branch information
filipesilva committed Nov 19, 2019
1 parent 4700965 commit 81041a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"serve-handler": "~6.1.2",
"shadow-cljs": "~2.8.71",
"taiko": "~1.0.2",
"taiko-diagnostics": "~0.4.0",
"zprint-clj": "^0.5.0"
},
"dependencies": {
Expand Down
20 changes: 12 additions & 8 deletions template/src/e2e/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[cljs.test :refer-macros [deftest is async use-fixtures]]
["http" :as http]
["serve-handler" :as serve-handler]
["taiko" :refer [openBrowser goto closeBrowser text]]))
["taiko" :refer [openBrowser goto closeBrowser text diagnostics]]))

; Serve public/ on a static server.
(use-fixtures
Expand All @@ -21,10 +21,14 @@
(async
done
(->
(openBrowser browser-opts)
(.then #(goto "http://localhost:5000"))
(.then #(.exists (text test-string)))
(.then #(is % (str "Text '" test-string "' should exist in page")))
(.catch #(is false "Should not have thrown errors"))
(.finally #(closeBrowser))
(.then #(done))))))
(openBrowser browser-opts)
(.then #(.logConsoleInfo diagnostics))
(.then #(.on %1 "logEntry" (fn [log] (is (not (= (.-level log) "error"))
(str "Should not log errors: "
(js/JSON.stringify log))))))
(.then #(goto "http://localhost:5000"))
(.then #(.exists (text test-string)))
(.then #(is % (str "Text '" test-string "' should exist in page")))
(.catch #(is false "Should not have thrown errors"))
(.finally #(closeBrowser))
(.then #(done))))))

0 comments on commit 81041a7

Please sign in to comment.