This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-12
Channels
- # babashka (22)
- # beginners (112)
- # calva (7)
- # cider (2)
- # clj-kondo (43)
- # cljdoc (25)
- # cljsrn (30)
- # clojars (16)
- # clojure (73)
- # clojure-australia (2)
- # clojure-bay-area (8)
- # clojure-europe (16)
- # clojure-finland (1)
- # clojure-italy (2)
- # clojure-nl (7)
- # clojure-uk (9)
- # clojurescript (28)
- # clojureverse-ops (2)
- # conjure (2)
- # css (22)
- # cursive (28)
- # datomic (9)
- # depstar (28)
- # emacs (6)
- # fulcro (39)
- # graalvm (61)
- # honeysql (38)
- # instaparse (3)
- # jobs (1)
- # kaocha (3)
- # malli (7)
- # pathom (83)
- # sql (3)
- # tools-deps (18)
- # vim (2)
- # xtdb (15)
hi, i currently have some clojure.test code that looks like this
(defn with-screenshots [test-fn]
(with-redefs [clojure.test/do-report take-screenshot-and-report]
(test-fn)))
this is part of some fixtures i use only for my browser tests (which i run from the repl as well as from CLI)
what would be the equivalent way of achieving this in kaocha? i think i could write a reporter that would take the screenshot when required, but how would i ensure it is only used on my browser tests?
my current idea is that it would look a bit like this:
(def ^:dynamic *enable-screenshots* false)
(defmethod screenshot :kaocha/fail-type [m]
(when *enable-screenshots*
(take-screenshot)))
(defn with-screenshots [test-fn]
(binding [*enable-screenshots* true]
(test-fn)))
and then put my screenshot reporter in my tests.edn for all tests, knowing that only tests using the with-screenshots
fixture would enable it