Questions tagged [ember-qunit]

Unit test helpers for Ember applications.

Ember-qunit is a tool design to enhance the ability to write unit tests for Ember applications.

Ember QUnit uses your application's resolver to find and automatically create test subjects for you with the moduleFor and test helpers.

See more:

160 questions
28
votes
1 answer

Ember upgrade breaks one test, and only in Safari

I'm trying to catch a Heisenbug. I'm updating our project from Ember CLI 0.2.0 and Ember 1.10.0 to Ember CLI 0.2.3 and Ember 1.11.1. This has been a pretty pain-free process, but I have exactly one test which now fails in Safari (7.1.5) only. It…
pjmorse
  • 9,204
  • 9
  • 54
  • 124
17
votes
2 answers

Acceptance test for file uploading in ember cli

I'd like to create a basic acceptance test in ember that uploads a file. I can mock the server with Pretender, but I need to know how to fill the input type="file" field with a file from my filesystem. So the questions are basically: How to fill…
Ungue
  • 442
  • 5
  • 14
17
votes
1 answer

ember-qunit: You can only unload a record which is not inFlight

I have some unit tests that access the store. I would have thought this would be fine, so long as I wrapped them in a run callback. Unfortunately, that's not the case. I'm getting this error: afterEach failed on #foo: Assertion Failed: You can only…
nullnullnull
  • 8,039
  • 12
  • 55
  • 107
15
votes
1 answer

PhantomJS 2.0 hanging on ember test

I have a straightforward ember-cli app. I run the unit tests with ember test, which runs them in phantomJS. A test using Function.prototype.bind is failing, because of the well-known issue of phantom 1.9.x missing that API. I installed phantom 2.0,…
user663031
14
votes
2 answers

Ember.js: Unit testing a helper that has a dependency injection?

In an initializer, I'm injecting an object into my helper, and it works properly in the App. But when testing the helper with QUnit, I get the following error: TypeError: undefined is not a function. The helper doesn't have access to the injected…
effel
  • 260
  • 2
  • 10
11
votes
1 answer

How do I depend on the store as a service in Ember unit tests using qunit?

According to the blog-post for ember-data version 1.0.0-beta.16 the store can now be used as a service: TweetComposerComponent = Ember.Component.extend({ store: Ember.inject.service() }); However, I can't figure out how to do qunit unit…
Kevin Bullaughey
  • 2,556
  • 25
  • 37
10
votes
1 answer

How to call hook before and after in ember-qunit tests?

I have to exec some code before all tests began. So I need to use QUnit hook before but in ember-qunit the only callbacks available are beforeEach and afterEach. How can I perform that?
EnriMR
  • 3,924
  • 5
  • 39
  • 59
9
votes
2 answers

Could not find module `ember-resolver` imported from `AppName/resolver Ember tests

I am trying to run Ember tests and it gives this error saying Could not find module ember-resolver imported from `AppName/resolver. I am not sure what is causing it. I am using Ember-cli-2.12.1. Any help would be appreciated. Thanks
Sandeep
  • 585
  • 7
  • 19
9
votes
2 answers

Testing an ember-data model - can't find relationship

I am trying to test a model relationship in an ember-cli application but it keeps telling me: No model was found for 'rateType'. It appears that it can't find my models. Files ~app/models/account.js ~app/models/rate-type.js Account Model export…
jax
  • 37,735
  • 57
  • 182
  • 278
7
votes
4 answers

findRecord giving error "Cannot read property '_internalModel' of undefined"

In our ember app, we are using following versions of ember-data and ember-data-factory-guy. package.json "ember-cli": "^1.13.8", "ember-data": "1.13.9", "ember-data-factory-guy": "1.13.10", Note: we are using active-model adapter, not yet migrated…
Swati
  • 842
  • 10
  • 26
7
votes
2 answers

Setting a global timeout in Ember-cli for Qunit

I cannot find anywhere that it is documented for ember-cli to set a global timeout for QUnit. I have found the documentation for QUnit: https://api.qunitjs.com/QUnit.config/ testTimeout (default: undefined) Type: Number Specify a global timeout in…
Michiel Bugher
  • 1,005
  • 1
  • 7
  • 23
7
votes
1 answer

How can I get source maps to work when running tests using ember-qunit for an ember app built on ember-cli

I have an Ember app built using ember-cli and I'm writing my tests using the ember-qunit testing adapter and running them in the browser using testem as instructed in the ember-cli documentation. Although debugging in Google Chrome works fine when…
Kevin Bullaughey
  • 2,556
  • 25
  • 37
6
votes
3 answers

Ember test fail with `testem.js not loaded?`

I'm getting below error message mentioned below for an ember project when running tests locally with ember test. most of time PhantomJS was hanging. $ ember test not ok 1 Chrome - error --- message: > Error: Browser failed to connect…
Shiv Kumar Baghel
  • 2,464
  • 6
  • 18
  • 34
6
votes
1 answer

ember render hbs swallowing thrown error

I have a simple component integration test: test('it throws error my-custom-input is called', function(assert) { assert.throws(() => { this.render(hbs`{{my-custom-input}}`); }, /my-custom-input component error/, 'Error must have been…
Ahmet Emre Kilinc
  • 5,489
  • 12
  • 30
  • 42
6
votes
1 answer

EmberJS: Unit test class-based helpers

I have several class-based helpers in my app, mostly so I can include the i18n service. Everything works nicely, however, I can't figure out a way to test them. The auto generated test is not working, as it expects a function to be exported and…
irruputuncu
  • 1,460
  • 1
  • 11
  • 24
1
2 3
10 11