How can I run Ember integration tests using Testem?


#1

I’m playing around with the new integration testing and the ember-testing package. I’ve also been using lineman for a development environment with Ember that I can completely separate from Rails.

I’d really like to know how to run my integration tests in Testem though… I keep gettting the following error and can’t for the life of me figure it out.

Unable to add "ember-application" class to rootElement. Make sure you set rootElement to the body or an element in the body.

Thanks!


#2

Were you able to make it work? I’m thinking about trying testem after some time using karma and I would be interested in your findings, if you could share them.


#3

Nah I gave up :slight_smile:

Just swapping to use rails-qunit.


#4

I got this working today. Config below…

window.App = Ember.Application.create({rootElement:'.js-new-desktop-experience'})

testem.json (I use lineman, so this would be my “config/spec.json” instead):

{
  "framework" : "qunit",
  "launch_in_dev" : ["PhantomJS"],
  "launch_in_ci" : ["PhantomJS"],
  "test_page" : "spec/testem.html"
}

spec/testem.html

<html>
  <head>
    <title>✔ Test'em</title>
    <script src="/testem/qunit.js"></script>
    <script src="/testem.js"></script>
    <script src="/vendor/bower/qunit-bdd/lib/qunit-bdd.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon/call.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon/spy.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon/behavior.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon/stub.js"></script>
    <script src="/vendor/bower/sinon/lib/sinon/mock.js"></script>
    <script src="/vendor/bower/jquery/dist/jquery.min.js"></script>
    <script src="/vendor/js/underscore.js"></script>
    <script src="/generated/js/app.js"></script>
    <script src="/vendor/bower/ember-qunit/dist/globals/main.js"></script>
    <script src="/vendor/bower/jquery-mockjax/jquery.mockjax.js"></script>
    <script src="/generated/js/spec.js"></script>
    <link rel="stylesheet" href="/testem/qunit.css">
  </head>
  <body>
    <div class='js-new-desktop-experience'></div>
  </body>
</html>