cemerick / clojurescript.test

A maximal port of `clojure.test` to ClojureScript. DEPRECATED
165 stars 32 forks source link

Using slimerjs to test on gecko #10

Closed jeluard closed 9 years ago

jeluard commented 11 years ago

SlimerJS is roughly the equivalent of PhantomJS for gecko. As it implements PhantomJS API it's trivial to adapt examples to use it.

Here is what I did:

And it works perfect!

Maybe worth adding to the documentation?

cemerick commented 11 years ago

+1, that's sweet. I don't know how I missed slimerjs when I was looking for a headless firefox/gecko impl.

Tangentially, setting up the runners needs to be easier, especially now that there's no reason to not have both configurations in place (assuming you have both phantom and slimer installed). gh-11 will help a bit, but the config seems more repetitive than I'd like.

cemerick commented 10 years ago

Would like to get this verified, documented, and rolled into the tests, but slimerjs isn't available in an apt repo (and therefore isn't available on travis), and I have no interest in schlepping it.

jeluard commented 10 years ago

I can see its inclusion in the default VM has been requested a couple months ago but no news.

kumarshantanu commented 10 years ago

I have similar experience as @jeluard's - tests run unchanged using both PhantomJS and SlimerJS with the default runner in 0.1.0. Pretty cool!

jeluard commented 10 years ago

I got slimerjs running on Travis CI with following configuration:

env:
  - SLIMERJSLAUNCHER=$(which firefox) DISPLAY=:99.0 PATH=$TRAVIS_BUILD_DIR/slimerjs:$PATH
addons:
  firefox: "24.0"
before_script:
  - "sh -e /etc/init.d/xvfb start"
  - "echo 'Installing Slimer'"
  - "wget http://download.slimerjs.org/v0.8/slimerjs-0.8.3.zip"
  - "unzip slimerjs-0.8.3.zip"
  - "mv slimerjs-0.8.3 ./slimerjs"
magomimmo commented 10 years ago

I can confirm too. Buy just installing slimerjs and configuring new :test-commands which call "slimerjs" instead of "phantomjs" everything works like a charm without even touch anything else.

cemerick commented 10 years ago

Will get to this soon. Pulled from the 0.2.0 milestone, tho.

cemerick commented 10 years ago

I've verified that slimerjs does work well as a drop-in phantomjs replacement. Before I recommend its use though, I'd like to see a resolution to the warnings it emits on startup, which might be flagged as errors depending on what key terms you're looking for in logs. (See the slimerjs issue I filed on this above.)

Aside from it working (impressive enough as-is), it is unfortunately dog-slow at the moment…like, literally > 3x slower than phantomjs on the most intensive ClojureScript test suite I have (all headless there, no DOM). A shame, and a bummer considering the version of webkit that phantomjs includes is fairly ancient. I don't track relative browser perf much, but I was really surprised; it's not like Firefox is 3x slower than Chrome or Safari AFAICT.

Anyway, will be keeping an eye on it for sure.

jeluard commented 10 years ago

There's also a similar project for IE: TrifleJS. I couldn't test it so far.

Arko2013 commented 10 years ago

Hello everyone,

I am trying to run automated test scripts with a combination of Slimerjs and Casperjs. It would be really helpful if someone can please send me the detailed steps to download and install Slimerjs(somehow I am not being able to install it).

cemerick commented 10 years ago

@Arko2013: I personally can't do any better than to point you to http://slimerjs.org; sorry.

jeluard commented 10 years ago

On OSX it's as simple as brew install slimerjs. For others OSes you can find full distribution here. Not sure about CasperJS.

cemerick commented 9 years ago

I just gave slimerjs another try, and I think it's quite ready for prime-time. The startup warnings are gone, and if you're using a recent Firefox (I have v34 installed locally) with the "lightweight" version of slimerjs (which uses the locally-installed Firefox instead of bundling its own XULRunner), the performance is totally respectable. Running my most strenuous clojurescript.test suite, slimer/firefox beats out phantomjs by ~10%. This is still half the speed of node, but given the API advantages of running in a browser and the simpler REPL story, this'll make slimer my primary JS environment for ClojureScript development.

The runner script does need to be tweaked slightly, but it will remain phantom-compatible. I'll land that change tomorrow.

Between the perf improvements and the clear path to using slimerjs on travis (thanks for figuring that out, @jeluard), clojurescript.test docs will now indicate slimer as the default test runner.

cemerick commented 9 years ago

Check out version 0.3.3-SNAPSHOT to run your tests with recent slimerjs builds. Docs have been updated with a recommendation for using it over phantomjs, final release going out soon.