Recommended testing packages (mainly headless UI testing)


#1

Hi, we are on the start to setup some tests for our meteor app.

So i was doing some research, mainly focused around mocha, jasmine, chimp and then i read about headless ui testing like phantomjs, spacejam also about Enzyme and other react component testing libraries.

Now i am bit overwhelmed by the flood of packages and possibilities that exist.

So i have come here for some recommendations and advice.

We have a Meteor application whith a blaze+react UI. We sure want to have unit tests but whats also very important for us is to test the UI. Our server has no graphic unit so we need to use headless browser engines for this. We would like to have code on ES6 syntax and it would be also nice if the testing ilbraries are meteor packages.

So can anyone give me some advice or report his/her own experiences with testing frameworks for similar purposes.


#2

I’ve tried a lot of ui testing frameworks and right now the easiest one, by far, is Protractor. The setup is just an npm install, you can use Chrome in headless mode, it waits for elements automatically (can’t stress enough how nice this is), etc.

Check out this React TodoMVC fully tested with Protractor : https://github.com/ManuelDeLeon/TodoMvc


#3

@goblins - thanks for asking this, I was just thinking of starting the same thread.

I’ve been referring to this thread: Mocha+Chai or Jest

I’ve been trying to follow the list awatson made, but is it possible to use all of these recommendations in a single meteor project?

I’ve been using Jest/Enzyme for React Unit Testing the last few days architecting my new project, but I haven’t figured out how to do meteor methods/publications/collections testing with Jest yet. I also haven’t figured out how to get the meteor test command to hook into jest .
I tried adding practicalmeteor:mocha to do the backend tests, but someone w/ more experience will probably verify, that I shouldn’t try using mocha and jest in the same repo unless I configure jest to execute on something different than .test.ts or /tests/ (oh yeah - I’m doing TypeScript too)

And then there’s https://chimp.readme.io which has “first-class” support for Meteor. I would have considered this route (maybe I still should), but I’m fully expecting to migrate away from Meteor in the next year and put it on a raw node stack (heading towards VulcanJS). So my goal with this project is to use as few meteor specific dependencies as possible.


#4

I’m a big fan of Chimp for UI testing, it’s just stupid simple. It comes with everything you need: includes its own selenium standalone and chromedriver, different test runner frameworks options (mocha, jasmine, cucumber), assertion libraries, and it has some Meteor-specific stuff.

I’m using CircleCI for builds, (which is a great service), you can see my CircleCI config file here for running unit tests and UI tests. The tests are running against a headless Chrome.

In that CircleCI config file, I’m just using the meteor command to spin up a local dev server and run UI tests against it with Chimp, but you could easily modify the workflow to run unit tests, then deploy your app to a preprod server, then run UI tests against that.


#5

We use chimp to test back end. Primary advantage is you don’t need to wait for rebuilds to edit the tests. This is integrated into our circle ci builds.

On the front end, we’re starting to use cypress.io and it’s been amazing so far. You write tests synchronously and it’s smart enough to wait for elements and retries if it’s necessary.


#6

Thx guys for the suggestions.

I had much troubles bringing chimp to work… so i skipped it and started of with Mocha which worked quite nicely and now i am beginning with the forntend testing part by Headless Browser Engines.


#7

I’m a big fan of Chimp for UI testing
Can you explain a bit why?

It never actually run a single test, i spent 2-3 days implementing but all i got was an output of:
Chimp is running…

Sometimes it stopped after that, sometimes it run forever.

There was no more output.