J'ai écrit un fichier de test pour un formulaire de connexion. La page de redirection est un tableau de bord avec une barre latérale Time Ticker. Maintenant, quand j'ai testé cela, je suis devenu un temps d'arrêt après 60000ms. Est-ce que je peux exclure le composant Time Ticker dans le test de braise?Test de connexion avec test Ember
Mon Code d'essai:
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);
});
});
Le temps Ticker Composante:
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'));
}
});
Oh, oui, c'est une bonne idée. Merci. – Daniel