【发布时间】:2017-09-02 15:06:44
【问题描述】:
我第一次开始验收测试我的 Ember 应用程序。
所以我从 login 开始:
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!");
});
});
它永远不会在andThen(),所以它挂在click("button[type=submit]");。
我明白为什么。
在我的 app/templates/index.hbs 中,我有一个组件 notifications,它依赖于一个 websocket,它在我的单页应用程序中一直处于挂起状态(如果我打开Chrome 有一个待处理的 websocket 调用...)。
如果我从我的 index.hbs 中删除这个组件,一切都会按预期工作。
登录后我应该告诉andThen() 助手忽略一直处于待处理状态的service('notifications') 的待处理状态?
怎么办?
【问题讨论】:
标签: sockets ember.js websocket ember-cli acceptance-testing