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

Not ending test.. #476

Closed
AdminDev826 opened this issue Apr 12, 2019 · 8 comments · Fixed by emberjs/ember.js#20210
Closed

Not ending test.. #476

AdminDev826 opened this issue Apr 12, 2019 · 8 comments · Fixed by emberjs/ember.js#20210

Comments

@AdminDev826
Copy link

AdminDev826 commented Apr 12, 2019

    "ember-cli": "^3.1.4",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^7.7.3",
    "ember-qunit": "3.4.1",
    "ember-exam": "^2.1.4",

ember test --filter='acceptance'

not ok 170 Chrome 73.0 - [6717 ms] - Acceptance | sales - customer-payment: sales - customer-payment
    ---
        actual: >
            Index - Desk Top Objects
        expected: >
            Sales - Companies
        stack: >
                at Object.<anonymous> (http://localhost:7357/assets/tests.js:30195:14)
        negative: >
            false
        Log: |
            { type: 'log',
              text: '\'No Company records received from server! -- \' \'/\'\n' }
    ...
ok 171 Chrome 73.0 - [20023 ms] - Acceptance | purchases - delivery-order-item-inst: purchases - delivery-order-item-inst
    ---
        Log: |
            { type: 'log',
              text: '\'No tab found! -- Purchase Orders -- \' \'/purchases/companies/1.0\'\n' }
    ...

Test won't end. (Test doesn't any progresses further) ...
But when I try to run test one by one, then all works fine.

@rwjblue
Copy link
Member

rwjblue commented Apr 15, 2019

This sort of thing is pretty hard for us to diagnose/debug without something we can run and look at. Please provide a reproduction...

@AdminDev826
Copy link
Author

Here is an acceptance test file:

import { module, test } from 'qunit';
import { click, visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { loginUser } from '../../helpers/login-user';

module('Acceptance | receivables - account-class', function(hooks) {
  setupApplicationTest(hooks);
 
  test('receivables - account-class', async function(assert) {
    await loginUser();

    // Visiting Root for account-class
    await visit('/receivables/account-classes');
    // Assert record list was found for tab Account Classes
    assert.dom('td.current-engine').hasText('Receivables - Account Classes');
    // Finding list for account-class
    var account_class_table = this.element.querySelector('table.receivables-account_class');
    if(account_class_table) {
      // Retrieving List for First Table Item for account-class
      await click('table.receivables-account-class .lt-body .lt-row');
      // Assert_record was found for Account Class
      assert.equal(find('td.current-engine').textContent, 'Receivables - Account Class');
    }else{
      window.console.log("No Account Class records received from server! -- ", currentURL());
    }
  });
});

And login-user:

import { click, visit, fillIn } from '@ember/test-helpers';
import ENV from '../../config/environment';

export async function loginUser() {
	const email = ENV.APP.EMAIL;
	const password = ENV.APP.API_HOST.includes('49002') ? ENV.APP.PRD_PASS : ENV.APP.DEV_PASS;
  await visit('/login');
  await fillIn('#identification', email);
  await fillIn('#password', password);
  return click('button.submit');
}

Thank you.

@rwjblue
Copy link
Member

rwjblue commented Apr 16, 2019

I really do not understand what is being reported here, please help me help you.

Test won't end.

What does this mean? A specific test never ends, the invocation of ember test never exits, something else?

Again, I highly doubt that we will be able to help without a runnable demo of this issue...

@AdminDev826
Copy link
Author

AdminDev826 commented Apr 24, 2019

Now I have updated the ember-cli and babel, qunit, qunit-dom versions.

    "ember-cli": "~3.2.0",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "7.3.0-beta.1",
    "ember-exam": "^3.0.1",
    "ember-qunit": "^4.4.1",
    "qunit-dom": "^0.8.4"

And the test didn't ended all day long... NO MORE PROGRESSES, NOT ENDING

    ...
ok 75 Chrome 73.0 - [19137 ms] - Exam Partition 1 - Acceptance | payables - closing-date: payables - closing-date
    ---
        browser log: |
            LOG: No Closing Date records received from server! --  /payables/closing-dates?parent=company&parent_id=1.0
    ...
ok 76 Chrome 73.0 - [16301 ms] - Exam Partition 1 - Acceptance | payables - company: payables - company
ok 77 Chrome 73.0 - [29289 ms] - Exam Partition 1 - Acceptance | payables - contact-type: payables - contact-type
    ---
        browser log: |
            LOG: No Contact Type records received from server! --  /payables/contact-types
    ...

And the testem.js file:

module.exports = {
  test_page: 'tests/index.html?hideskipped&timeout=600001',
  disable_watching: true,
  launch_in_ci: [
    'Chrome'
  ],
  launch_in_dev: [
    'Chrome'
  ],
  timeout: 600002,
  browser_start_timeout: 600003,
  browser_disconnect_timeout: 600004,
  browser_args: {
    Chrome: {
      ci: [
        // --no-sandbox is needed when running Chrome inside a container
        process.env.CI ? '--no-sandbox' : null,
        '--headless',
        '--disable-gpu',
        '--disable-dev-shm-usage',
        '--disable-software-rasterizer',
        '--mute-audio',
        '--remote-debugging-port=0',
        '--window-size=1440,900'
      ].filter(Boolean)
    }
  }
};

I think the issue is may still related with browser timeout...
The are so many acceptance test files..
If I test per file, then all works fine.. but test all at once is not working..
Thank you.

@enspandi
Copy link

I've also experienced this issue in the last days, just after upgrading to Ember 3.9 (from 3.4). The test suite just repeated every time and never came to an end... travis cancelled it after 2 hours.

After countless hours of digging I found out it was because of an 2 year old integration test that is still using the old syntax with moduleForComponent . I didn't actually find out what's so special about it, but it definitely caused the issue in our project:

import { later } from '@ember/runloop';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import jQuery from 'jquery';

moduleForComponent('form', '...', {
  integration: true,
});

test('...', function(assert) {
  const done = assert.async();
  assert.expect(2);
  this.render(hbs`Hello World`);
  jQuery('button', this.element).click();
  later(() => {
    assert.ok(true, '...');
    done();
  }, 100);
});

I know that this test looks very strange ^^. Anyway, if I just removed one line it was working again - even when I tried to remove the jQuery(...).click() - so likely a race condition?

@AdminDev826 Maybe you can check if that's also the cause in your project? Since you mention it does work when running a single test - maybe it was just not the one that's causing the errors. Also check for tests using this.render(...) instead of await render(...) and similar code.

Really difficult to find this issue... would've been helpful to have some kind of warning that we still have tests using legacy functionality.

@tehhowch
Copy link

I encountered a hang today when executing ember test when a TestLoader failure is encountered (specifically, a missing dependency):

not ok 1022 Chrome 104.0 - [1 ms] - TestLoader Failures: my-app/tests/unit/services/component-css-test: could not be loaded
    ---
        actual: >
            null
        stack: >
            Error: Could not find module `chai` imported from `my-app/tests/unit/services/component-css-test`
                at missingModule (http://localhost:4202/assets/vendor.js:18358:11)
                at findModule (http://localhost:4202/assets/vendor.js:18369:7)
                at Module.findDeps (http://localhost:4202/assets/vendor.js:18279:24)
                at findModule (http://localhost:4202/assets/vendor.js:18373:11)
                at requireModule (http://localhost:4202/assets/vendor.js:18135:15)
                at TestLoader.require (http://localhost:4202/assets/test-support.js:8444:9)
                at TestLoader.loadModules (http://localhost:4202/assets/test-support.js:8436:14)
                at loadTests (http://localhost:4202/assets/test-support.js:9912:22)
                at start (http://localhost:4202/assets/test-support.js:9694:33)
                at Module.callback (http://localhost:4202/assets/tests.js:12431:25)
        message: >
            Died on test #1: Could not find module `chai` imported from `my-app/tests/unit/services/component-css-test`
                at TestLoader.moduleLoadFailure (http://localhost:4202/assets/test-support.js:9887:13)
                at TestLoader.require (http://localhost:4202/assets/test-support.js:8446:14)
                at TestLoader.loadModules (http://localhost:4202/assets/test-support.js:8436:14)
                at loadTests (http://localhost:4202/assets/test-support.js:9912:22)
                at start (http://localhost:4202/assets/test-support.js:9694:33)
                at Module.callback (http://localhost:4202/assets/tests.js:12431:25)
                at Module.exports (http://localhost:4202/assets/vendor.js:18217:32)
        negative: >
            false
        browser log: |
    ...

ember test command runs all of the tests it can, and the last test reported is ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly. After that, the console just hangs. If i send SIGINT, i get another reported (but unidentifiable) error as well:
image

@rwjblue
To repro:

  1. run ember init to create a new Ember app
  2. run ember g acceptance-test application
  3. add an unresolvable import to the generated test file, such as import chai from 'chai';
  4. run ember test

@patricklx
Copy link

same here, test does not timeout even with assert.timeout.

i debugged it to the following:

qunit sets up a timeout handler for the current await promise in the test:
https://github.com/qunitjs/qunit/blob/main/src/test.js#L739

not that it only supports one timeout handler.

ember rsvp calls the test adapter startAsync which then sets up another timeout handler. this one is called e.g. by the router in transitionto and might not resolve.
https://github.com/emberjs/ember.js/blob/master/packages/ember-testing/lib/ext/rsvp.ts#L11

this one timeous out in qunit. but qunit keeps track of all promises that did not resolve. therefore test.pauses.size > 0
https://github.com/qunitjs/qunit/blob/main/src/test.js#L1038
and the tests will not timeout and not continue to another

@patricklx
Copy link

doing

import { _backburner } from '@ember/runloop';
import { RSVP } from '@ember/-internals/runtime';

RSVP.configure(
  'async',
  function (callback, promise) {
    _backburner.schedule('actions', () => callback(promise));
  }
);

fixes it for me

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

Successfully merging a pull request may close this issue.

5 participants