samedi 2 septembre 2017

Ember 2, acceptance testing, websocket pending hangs andThen() wating for pending to finish

I'm starting for the first time in Acceptance testing my Ember application.

So I started from login with this:

test/acceptance/login-test.js:

import { test } from "qunit";
import moduleForAcceptance from "myapp/tests/helpers/module-for-acceptance";

moduleForAcceptance("Acceptance | login");

test("Should login", function(assert) {
  visit("/login");
  fillIn("input[type=email]", "user@email.com");
  fillIn("input[type=password]", "userpass");
  click("button[type=submit]");

  andThen(() => {
    assert.equal(currentURL(), "/");
    assert.equal(find("h1").text(), "Hello!");
  });
});

It never goes in andThen(), so it hangs on click("button[type=submit]");.

I understand why.

In my app/templates/index.hbs I have a component notifications which rely on a websocket which is constantly in pending in my single page application (if I open Chrome there is a pending websocket call...).

If I remove this component from my index.hbs everything works as expected.

After the login I should tell to andThen() helper to ignore the pending state of that service('notifications') which is constantly in pending state?

How to do?




Aucun commentaire:

Enregistrer un commentaire