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
1
vote
2 answers

stub performance.now() using Sinon.js

I am writing unit tests in Ember-qunit. I want to set a custom value on performance.now. I tried sinon.stub(performance,'now', 60000); but this didn't work. I get TypeError: stub(obj, 'meth', fn) has been removed. how do i stub performance.now()…
renekton
  • 13
  • 4
1
vote
1 answer

Ember Test for parent route with method calls

I was brought in on the "back-end" of a project and asked to help write tests for an app. I am very new to Ember and need just a little help getting started. We are trying to provide unit test for the routes, so we can have a bit more molecular…
1
vote
1 answer

setApplication breaks ember-qunit test context

I recently upgraded an Ember app from 2.18 to 3.13 which went smoothly. Today I tried to add an acceptance test for the first time (only had integration / unit tests before this) but the test is failing on the first line: import { module, test }…
stevenelberger
  • 1,368
  • 1
  • 10
  • 19
1
vote
2 answers

How can I add properties to a component in a unit test before init?

I'm working on an Ember component with an init function that I'd like to add a unit test for. The component has the following properties: 1) The init function must not be run more than once, and 2) The component depends on having a model…
Glyoko
  • 2,071
  • 1
  • 14
  • 28
1
vote
2 answers

How do I trigger a function in an Ember component from the test component?

In the unit test ComponentA-test I would like to trigger the function load() in ComponentA, but I have problems doing so. Before the assert.equal in the below code example I would like to add something simular to this.load() that I would have…
trito
  • 11
  • 1
1
vote
1 answer

Is there any way to run ember acceptance test case in slow mode?

I have written some ember acceptance test cases. The thing is when I visit the URL http://localhost:4200/tests and filter module by Acceptance, the test cases are running lightning fast. Even though those were written in async await function. I want…
rinold simon
  • 2,782
  • 4
  • 20
  • 39
1
vote
1 answer

Ember acceptance test fails with error You have turned on testing mode, which disabled the run-loop's autorun

I am writing acceptance test for which I get the following error Uncaught Error: Assertion Failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in a run This…
Veda
  • 11
  • 1
1
vote
0 answers

Qunit assert throws not working

I am trying to assert that a few steps in the code (visiting page, providing wrong card-number, password combination and clicking submit)should generate an error from the backend service - I have referred to this already.. and tried the suggestion…
Robin Bajaj
  • 2,002
  • 4
  • 29
  • 47
1
vote
1 answer

Calling visit() in acceptance test Ember 2.8.0 times out

I have a simple acceptance script below which only checks for the currentURL. However whenever I run the test it only gives me timeout. import { test } from 'qunit'; import moduleForAcceptance from…
Emil Reña Enriquez
  • 2,929
  • 1
  • 29
  • 32
1
vote
1 answer

Ember Test: input focus

I really don't understand the chain of events that's happening here. Trying to follow the guide as well as possible. I have: test('Tab focus', function(assert) { visit('/demo/form'); click('input[type=text]'); andThen(function() { …
Brian
  • 2,819
  • 4
  • 24
  • 30
1
vote
0 answers

Ember 2.8: Unit testing for HTML5 audio tag playing

I'm writing some acceptance tests for my main route, and in my app some audio plays on load time. I would like to write up a test for this. This is what I'm thinking: test('audio should be playing at startup', function(assert) { var isPaused =…
1
vote
0 answers

Called stop() outside of a test context in Ember acceptance test

I made my first acceptance test with Ember CLI. I use Ember Mirage to mock the server. test('create file', function(assert){ visit('/login'); fillIn('input[name=username]', 'Joe'); fillIn('input[name=password]', 'foo'); …
user3568719
  • 1,036
  • 15
  • 33
1
vote
1 answer

How does ember-qunit render components in integration testing?

Here is a basic component / integration test for ember-qunit. import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('my-component', 'TODO: put something here', { integration:…
shane
  • 246
  • 2
  • 17
1
vote
1 answer

Ember controller test is not using prototype extension when called

I am trying to unit test an Ember addon that has already been written but unfortunately did not get tested at the time of its creation. I would really really like not to have to modify the existing codebase to fit the tests if possible. Controller…
shane
  • 246
  • 2
  • 17
1
vote
0 answers

Unit testing using ember-qunit controller action which access the store and methods

I have built a small Ember App. It has a controller which has an action named changeStatus(id). This method access the store and try to change an attribute value. I am relatively new to Ember. I don't know whether best way is to test it with…
Entwickler
  • 255
  • 2
  • 12