Skip to content

Commit 81041a7

Browse files
committed
fix: check no errors are logged on e2e
Fix #26
1 parent 4700965 commit 81041a7

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"serve-handler": "~6.1.2",
2020
"shadow-cljs": "~2.8.71",
2121
"taiko": "~1.0.2",
22+
"taiko-diagnostics": "~0.4.0",
2223
"zprint-clj": "^0.5.0"
2324
},
2425
"dependencies": {

template/src/e2e/core.cljs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[cljs.test :refer-macros [deftest is async use-fixtures]]
44
["http" :as http]
55
["serve-handler" :as serve-handler]
6-
["taiko" :refer [openBrowser goto closeBrowser text]]))
6+
["taiko" :refer [openBrowser goto closeBrowser text diagnostics]]))
77

88
; Serve public/ on a static server.
99
(use-fixtures
@@ -21,10 +21,14 @@
2121
(async
2222
done
2323
(->
24-
(openBrowser browser-opts)
25-
(.then #(goto "http://localhost:5000"))
26-
(.then #(.exists (text test-string)))
27-
(.then #(is % (str "Text '" test-string "' should exist in page")))
28-
(.catch #(is false "Should not have thrown errors"))
29-
(.finally #(closeBrowser))
30-
(.then #(done))))))
24+
(openBrowser browser-opts)
25+
(.then #(.logConsoleInfo diagnostics))
26+
(.then #(.on %1 "logEntry" (fn [log] (is (not (= (.-level log) "error"))
27+
(str "Should not log errors: "
28+
(js/JSON.stringify log))))))
29+
(.then #(goto "http://localhost:5000"))
30+
(.then #(.exists (text test-string)))
31+
(.then #(is % (str "Text '" test-string "' should exist in page")))
32+
(.catch #(is false "Should not have thrown errors"))
33+
(.finally #(closeBrowser))
34+
(.then #(done))))))

0 commit comments

Comments
 (0)