How do you run front-end (cljs) tests?

clojurescript

#1

Several of my projects are to the stage of benefiting from good front-end (interface/experience) testing, using Reagent as the front-end. I plan to start with the Luminus approach (http://www.luminusweb.net/docs/testing.html#clojurescript) but thought I’d check here first. What are your experiences and recommendations for front-end testing?


#2

Not an expert at all on the tooling aspect for CLJS testing, but here are some ideas regarding the approaches:

  • For testing the “logical” aspects (computations, state transitions etc.), we all know the drill: write that logic as pure function manipulating simple data. Then it’s the same story as for backend testing.
  • Testing the “UX” is knowingly difficult… You could do some end-to-end tests (a Clojure REPL is great for tuning those)
  • Not exactly automated testing, but do you know about devcards?
  • This talk about full-stack testing in Clojure seems somewhat related

#3

I find integration testing is really important one among others. Selenium tests are good enough to cover user’s workflows in your app.


#4

For integration testing I’ve had success with SparkleDriver, but I’ve also heard good things about etaoin.


#5

Whoa… etaoin looks great!


#6

We also use eatoin, it’s really good.

We’ve run into some race-condition scenarios, particularly when running the tests on smaller testing agents (ex. SemaphoreCI/VSTS) that forced us to add some pauses to the etoin tests to make sure the DOM and all assets load before a test is run. Not sure if there’s a way to avoid racy tests, but I think that’s also par for the course as far as front-end testing goes with things like selenium.