Questions tagged [ember-testing]

ember-testing is a core part of Ember framework. Ember framework has its own testing architecture and provides infrastructure for application development.

Ember Framework's testing infrastructure is defined in the Ember Guide. It classifies tests as:

  1. Acceptance Tests
  2. Unit Tests
  3. Integration Tests

Ember-testing provides its capability by using qunit testing framework. Since qunit is default, other frameworks are also supported via third-party addons.

To get better help on questions, consider preparing a twiddle in ember-twiddle.com. ember-twiddle supports running tests. (Just click Run Tests on the screen.)

134 questions
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
1 answer

How to mock binary response in Mirage

Using Mirage i need to mock my GET request which returns data in the form of binary string (the format is gzip). It is my first time using mirage and i don't know if i'm mocking a binary response, should I return a valid value? here is how i mocked…
user5471528
  • 217
  • 2
  • 9
14
votes
1 answer

Instance initializer unit test fails with "store is undefined"

After generating an example application: ember new preloadtest cd preloadtest/ ember g instance-initializer preload ember g model test-data ember g route index ember g adapter application With the following files: models/test-data.js import DS from…
MT0
  • 143,790
  • 11
  • 59
  • 117
11
votes
1 answer

Ember-cli unit tests with relationships 'needs'

I am working on my unit tests and it feels like I am doing something incorrect. I have a 'main' object that has many relationships author: belongsTo('person', { async: true }), title: attr('string'), category: belongsTo('category', { async: true…
RyanHirsch
  • 1,847
  • 1
  • 22
  • 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
8
votes
1 answer

ember tests passing in chrome, not in phantomjs

I have tests for an addon which pass in chrome, but fail in phantomjs. It seems to be a problem similar to this question. However, I tried the solution there and it didn't work for me. The code is all available in the public repo linked above. The…
shaunc
  • 5,317
  • 4
  • 43
  • 58
8
votes
2 answers

How to do Ember integration testing for route transitions?

I'm having a problem doing integration testing with ember using Toran Billup's TDD guide. I'm using Karma as my test runner with Qunit and Phantom JS. I'm sure half of if has to do with my beginner's knowledge of the Ember runloop. My question is 2…
ganicus
  • 321
  • 5
  • 12
7
votes
2 answers

How to focus/blur on a component in ember integration tests?

How can I trigger focus and blur events while testing an Ember.js component? this.$().focus(); or this.$('input').focus(); seems working but behaves different in phantomjs and chrome. Also this.$().blur(); or this.$().focusout(); seems not working…
ykaragol
  • 6,139
  • 3
  • 29
  • 56
6
votes
1 answer

Ember.js: Component attribute not reset while testing

I am currently attempting an acceptance test on a nested route, which makes use of the same component twice, but with different arguments. This works fine when I run it normally, however as I run the acceptance test, I notice that the component's…
finferflu
  • 1,368
  • 2
  • 11
  • 28
6
votes
3 answers

Ember testing: You have turned on testing mode, which disabled the run-loop's autorun

I am trying to write a simple Ember integration test and continue to get the frustrating run loop error despite using Ember.run. I've had a nightmare of a time trying to get this to work, if anyone could help me I'd be so grateful. Specifically, I…
6
votes
0 answers

Handle "The backend rejected the commit because it was invalid" during test

I've got an ember-cli app that's using Ember Data and I'm trying to write an acceptance test that covers the failure case of submitting a form to ask a question. In the test, I'm mocking the response with Pretender to return an errors object, and…
HeroicEric
  • 876
  • 5
  • 13
5
votes
3 answers

Ember JS tutorial: TypeError: Cannot read property 'maps' of undefined

I am currently running through the official EmberJS tutorial on their website and I'm on this part. Everything works perfectly in the app itself when I run ember serve but the problem is when I run the unit tests for the new service. I am running…
Sticky
  • 3,671
  • 5
  • 34
  • 58
5
votes
1 answer

How to test route's willTransition action in Ember?

How can I test this code in Ember? Explain me please the concept, in general. // app/routes/products/new.js import Ember from 'ember'; export default Ember.Route.extend({ model() { return this.store.createRecord('product'); }, actions: { …
Molfar
  • 1,411
  • 3
  • 18
  • 49
5
votes
1 answer

Ember Testing route redirect

I am very new to Ember and have never written a test case before. I currently have a route that is being used as a base class and will be extended by other routes to use the same behavior for redirecting. Here is what the route looks like: import…
Surep
  • 179
  • 4
  • 19
5
votes
2 answers

EmberJS global error when running tests

I am trying to integrate automated testing using Ember Testing. The application runs fine on browser, without any errors. I tried simply running ember test on command line, but get a bunch of global errors and all the tests fail. These are the…
roca323
  • 455
  • 2
  • 8
  • 26
1
2 3
8 9