0
로그인 공식을위한 엠버 테스트 파일을 작성했습니다. 리디렉션 페이지는 타임 티커 사이드 바가있는 대시 보드입니다. 자, 내가 이것을 테스트했을 때, 나는 60000ms 후에 테스트 타임 아웃이되었다. 엠버 테스트에서 타임 티커 구성 요소를 제외 할 수 있습니까?Ember 테스트를 통한 로그인 테스트
내 테스트 코드 :
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', '[email protected]');
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'));
}
});
오, 예, 좋은 생각입니다. 감사합니다. – Daniel