Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test timed out. #327

Open
devdemi opened this issue Apr 12, 2018 · 7 comments
Open

Test timed out. #327

devdemi opened this issue Apr 12, 2018 · 7 comments

Comments

@devdemi
Copy link

devdemi commented Apr 12, 2018

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

@nlfurniss
Copy link
Contributor

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

@chris-aeviator
Copy link

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.

@BobrImperator
Copy link

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

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

@Mifrill
Copy link

Mifrill commented May 31, 2020

@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
Copy link

Mifrill commented May 31, 2020

@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
Copy link

Mifrill commented May 31, 2020

ah 😄 sorry, the main goal of this issue was completely different 😃

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

@NetFreak26
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants