正在与验收测试作斗争。从基本登录测试开始:
import { test } from 'qunit';
import moduleForAcceptance from 'static/tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | authentication');
test('login', function(assert) {
visit('/');
click('.nav-bar__login-link');
andThen(function() {
assert.notOk(find('.login-form__submit-button').attr('disabled'));
});
fillIn('.login-form__email-block input', "ruz@email.com");
fillIn('.login-form__password-block input', "qwe");
click('.login-form__submit-button');
andThen(function() {
console.log("ftw");
assert.equal(find('.nav-bar__profile-link').text(), "some");
});
});问题是andThen回调是在身份验证完成之前调用的。这是jQuery ajax请求和之后的几个承诺。据我所知,ember等待ajax查询完成,但不等待承诺得到解决/拒绝。这个测试应该开箱即用吗?我必须写一个定制的服务生吗?
发布于 2017-04-25 12:40:04
听起来你的承诺可能没有设置好,对吧?但是不,您应该能够使用验收测试助手编写测试,并且不需要自己担心异步调用的建立(或承诺解决)
https://stackoverflow.com/questions/43547516
复制相似问题