Creating integration tests for Peepcode Ordr app in Ember.js

I am interested in writing integration tests for the Peepcode Order application as a testing suite in Ember.js however I am stumbling though getting a “integration” package setup to run in Ember.

I’ve added an “integration” suite in ember-dev.yml I also added an “integration” distro in the Assetfile

For the package I created:

To test the package I run rackup and view http://localhost:9292/?package=integration

However I get an error that minspade can’t find the “integration” module.

Uncaught The module 'integration' could not be found
Source: 	
http://localhost:9292/minispade.js:39

Can someone point me in the right direction for setup of an “integration” suite?

Best regards,

-Bill

Ah, I needed to add an empty module in lib to appease minispade.

added:

  • packages/integration/lib/main.js

I don’t think this is possible to add a full app as an integration test suite within Ember as this Peepcode app needs Ember data too. I think I’ll try another way to write integration tests.

On Travis CI we use Jasmine specs runner to run integration tests, if any of the tests needs an initialized app we use such helper: https://github.com/travis-ci/travis-web/blob/master/assets/scripts/spec/spec_helper.coffee#L3-L10.

One more change that we needed to do was to style jasmine output to be located over the app, so you can see the tests output clearly. You may check it out by doing:

git clone https://github.com/travis-ci/travis-web.git
cd travis-web
bundle install
bundle exec rakep
bundle exec foreman start
open http://localhost:5000/spec.html

You could have a similar setup with other kinds of runners as well.

Thanks @drogus for the travis-ci examples I really to enjoy testing with Jasmine!

For now was able to write some integration tests for the Peepcode Ordr the app using QUnit.

See QUnit runner at github.com/Ember-SC/peepcode-ordr-test/blob/qunit/js/tests/index.html Integration Tests are at https://github.com/Ember-SC/peepcode-ordr-test/blob/qunit/js/tests/tests/integration.js

A few findings:

  • Was not able to use Ember.testing = true then execute tests inside an Ember.run function.
  • Put app in it’s own root element #app-root (not inside #qunit-fixtures)
  • Listen for ready event using App.ready and put test suite inside ready function
  • Used setTimeout with start() and stop() and spaced out test steps 500ms
  • Used document.location.hash = "/tables/1" instead of triggering clicks

My notes on this thread are out of date, the new ember-testing package made it way easier to write tests using the testing helpers like visit().

Drogus,
I see in last master of travis-web that you moved from jasmine to qunit and finally remove (comment) some test. Would it be possible that you explain what did you make move away from Jasmine ? Did you encounter some problems with your setup ?

@adriencoquio sorry for a super late answer, I think I didn’t get a notification on the email and I spotted the notification on the forum just now. I moved to qunit, because it’s supported by Ember.js out of the box and at the moment when I was working on upgrading Ember.js I was really frustrated with a state of our test at Travis CI, so I wanted to quickly fix it. It’s probably not hard to add jasmine support to Ember.js, but I didn’t feel like I want to experiment.

No problem @drogus, thanks for your answer.