jeudi 30 juin 2016

Ember 1.13.15 acceptance test, pass and fail randomly or app.reset() does not clean up

I ran into this problem recently:

One of my acceptance test fail in one time and pass in next time and so on - it keepflipping the testing indicator flag. The failed error is

expect 4 tests but 0 were run.

That means it does not hit the andThen after click three times.

It always pass if I filter and run the test alone.

The scenario is when use click on one button if will fire a service call to backend if server receive three times it will pass 429 response. The 429 response will update array1 and array2 object and computed property disableTemplate will return true or false based on that.

Here is my code:

Template.hb


    //some template code    


Template/component controller.js

disableTemplate: Ember.Computed('array1, array2', function(){
    //some logic to return boolean.
})

Acceptance tests.js

test('button locked after clicking three times', function(assert) {
    assert.expect(4);
    andThen(()=> {
      click('.resend-btn');
    });
    andThen(()=> {
      click('.resend-btn');
    });
    andThen(()=> {
      click('.resend-btn');
    });

    andThen(()=> {
        assertSomething('.body', '5067');
        click('.cancel-btn');
    });

    andThen(()=> {
        click('button.show');

    andThen(()=> {
        assertSomething('.body', '5067');
    });
  });
});




Aucun commentaire:

Enregistrer un commentaire