Testing 使用Ember测试进行登录测试
我已经为一个登录公式编写了一个余烬测试文件。重定向页面是一个带有时间指示器侧栏的仪表板。现在,当我测试这个的时候,我在60000毫秒后变成了一个测试超时。我可以在余烬测试中排除时间计时器组件吗 我的测试代码:Testing 使用Ember测试进行登录测试,testing,ember.js,Testing,Ember.js,我已经为一个登录公式编写了一个余烬测试文件。重定向页面是一个带有时间指示器侧栏的仪表板。现在,当我测试这个的时候,我在60000毫秒后变成了一个测试超时。我可以在余烬测试中排除时间计时器组件吗 我的测试代码: import {test} from 'qunit'; import moduleForAcceptance from 'frontend/tests/helpers/module-for-acceptance'; moduleForAcceptance('Acceptance | Lo
import {test} from 'qunit';
import moduleForAcceptance from 'frontend/tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | Login', {
integration: true
});
test('visiting /user_session/new', function (assert) {
visit('/user_session/new');
fillIn('input#login-email', 'test@example.de');
fillIn('input#login-password', 'blabla');
click('button.btn-primary');
let done = assert.async();
andThen(() => {
Ember.run.later(null, () => {
assert.equal(currentURL(), '/dashboard', 'redirects to the dashboard');
done();
}, 1000);
});
});
时间标记器组件:
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'time',
date: moment().format('DD.MM.YYYY'),
time: Ember.computed('value', function() {
return moment().format('HH:mm:ss');
}),
didInsertElement: function() {
this.tick();
},
tick: function() {
this.set('nextTick', Ember.run.later(this, function() {
this.notifyPropertyChange('value');
this.tick();
}, 1000));
},
willDestroyElement: function() {
Ember.run.cancel(this.get('nextTick'));
}
});
在服务中包装勾选机制,并在组件中使用该服务 在测试期间,模拟该服务并将模拟注入组件中。虽然在接受测试中进行模拟对我来说不是一件好事,但在这个场景中我可以使用模拟方法
也可以考虑在网页中使用<代码>余烬时刻的实时更新。它提供实时的时间更新。服务中有。
包装滴答机制,并在组件中使用该服务 在测试期间,模拟该服务并将模拟注入组件中。虽然在接受测试中进行模拟对我来说不是一件好事,但在这个场景中我可以使用模拟方法也可以考虑在网页中使用<代码>余烬时刻的实时更新。它提供实时的时间更新。有