@cjsauer yes, I don't think there's any other way in clojure.test
to catch test failures
Hm, something is still off. I can't get this code to actually report the exception let alone take a screenshot:
(def ^:dynamic *driver*)
(defn driver-fixture
"Executes a test running a driver. Bounds a driver
with the global *driver* variable."
[f]
(doseq [type driver-types]
(with-driver type {} driver
(binding [*driver* driver]
(testing (format "Testing in %s browser" (name type))
(f))))))
(use-fixtures :each driver-fixture)
(deftest ^:acceptance
test-error
(with-postmortem {:dir "screenshots/"}
(do (go *driver* "<https://wikipedia.com>")
(throw (Exception. "not working")))))
Ran 1 tests containing 0 assertions.
0 failures, 0 errors.
@cjsauer FWIF, I use test-ns-hook
😛
also FWIF, I use one driver and even one browser for the whole suite if possible, to speed up things, but it can be more error prone
@borkdude I think I'm going to try out the test-ns-hook
approach soon
Unrelated to this issue, but is there an open source CircleCI config file I can peek at, and potentially a Dockerfile? I'm having trouble understanding how etaoin works on a CI server.
Specifically the dependencies required.
you need to have chromedriver around, but I use a Docker image for that
but you can also install chromedriver + Chrome locally (or other browsers)
@borkdude do you know would I be getting obvious error messages if this wasn't installed correctly? Like a chromedriver: command not found
kind of error? I keep getting strange errors on my wait-exist
commands. They timeout on CircleCI but the :message
field is always nil
...I've tried capturing a screenshot as well, but the screenshot comes back as a white screen...
I realize this isn't the most helpful debug info 😅
not sure about that one, I don’t use CircleCI
but I test on my local machine from the REPL and with Docker, so it’s almost the same as on the server
Gotcha. I'll keep digging. Would be amazing to get etaoin running on Circle
Locally my tests run just fine, which makes me think it's a dep issue
how do you run locally, with a native browser?
I've tried both the :headless
type and the :chrome
type. I'm using Chromium locally (native browser)
This is on Ubuntu (Xubuntu)
It usually works just fine. I recently started running into a "cannot load your profile" error when Chromium launches, but I that's a non-related issue
I use this construct to test for a CI server: (def driver-types [(if CI :headless :chrome)])
I'm using this docker image as a base: circleci/clojure:lein-2.7.1-browsers
, so I believe that the necessary browser deps are installed
I don’t know how this works. Is the docker container available from a port or are you running inside this container?
The tests are run inside the Docker container