ember-qunit icon indicating copy to clipboard operation
ember-qunit copied to clipboard

Test timed out.

Open devdemi opened this issue 7 years ago • 7 comments
trafficstars

Hi, I've started with acceptance tests in Ember.js and wrote simple test

test('visit teacher', async function(assert) {
        await visit('/teacher/6');
        assert.ok(find('h1.name'), 'Ричард_test');
});

And when I start test I get error: Test took longer than 60000ms; test timed out.@ 60099 ms This route requests data from server. But when I try to create test of visiting route without data requests then test runs well. I use Ember 3.1 and ember-qunit 3.4.0

devdemi avatar Apr 12 '18 15:04 devdemi

Are you mocking the response? If not, the promise created in your route to fetch data will not resolve, the test can't move on, and it will time out

nlfurniss avatar May 02 '18 02:05 nlfurniss

So do you have any idea on how to modify the timeout - my ember-qunit also runns into this when using the await pauseTest() function, which kind of destroys your debugging session (in the browser) after that timeout.

It would be useful to disable or set the timeout to a very high value via the commandline to adjust.

One (in my view) valid use-case of ember-quit is also to help as a interaction script when doing tdd - I'd like to test something which is several steps away (click button, fill form, …) from my route entry, which are steps I do not want to always redo manually after a file change.

chris-aeviator avatar Nov 26 '18 16:11 chris-aeviator

@chris-aeviator I usually run a specific test in devmode, then the pauseTest won't timeout.

also https://api.qunitjs.com/config/QUnit.config

BobrImperator avatar Apr 24 '19 08:04 BobrImperator

@devdemi check the redefine of QUnit.config.testTimeout value in config files. most luckely here: tests/test-helper.js it looks like it redefined to 60000 in your case to force the fail on unexpected errors.

so, to resolve this issue we can temporarily change this value into default: undefined:

QUnit.config.testTimeout = undefined;

QUnit.config.testTimeout (number) | default: undefined source: https://api.qunitjs.com/config/QUnit.config

Mifrill avatar May 31 '20 08:05 Mifrill

@BobrImperator it seems like you using the updated version of ember-qunit-cli that why it works for you in dev mode: https://github.com/ember-cli/ember-cli-qunit/pull/120/files

@devdemi so, before upgrade we can you the same approach here:

QUnit.config.testTimeout = QUnit.urlParams.devmode ? undefined : 60000;

Mifrill avatar May 31 '20 08:05 Mifrill

ah :smile: sorry, the main goal of this issue was completely different :smiley:

I was surfed and looked at the last comments only, so decided that the issue is that the test crashes with timeout error when pauseTest is used for debugging

so this response is totally correct:

Are you mocking the response? If not, the promise created in your route to fetch data will not resolve, the test can't move on, and it will time out

Thanks to @nlfurniss

This route requests data from server. But when I try to create test of visiting route without data requests then test runs well.

check the mock of get requests in your mirage server config, you probably have mock like: this.get('/teacher'); but not like: this.get('/teacher/:id');

so, just add it, btw, it probably should be teacherS not teacher to produce the index request, and /teachers/:id for show request

Mifrill avatar May 31 '20 08:05 Mifrill

Are you mocking the response? If not, the promise created in your route to fetch data will not resolve, the test can't move on, and it will time out

Hey, can u also tell where we can mock the response like in which directory or file?

NetFreak26 avatar Nov 11 '21 12:11 NetFreak26