Reputation: 153
Hello: I have an Angular test that includes a table of data after a search. So, I need to test if data exists or not and then do something if it does. Please advise how I can do this. I am still learning how to use "a promise" to test true or false situations, plus gather data from a promise. So, please help with specifics on how to accomplish this.
Upvotes: 2
Views: 2459
Reputation: 16732
it('ensures there is a table loaded before moving on', function() {
expect($('table').isPresent()).toBeTruthy();
});
it('conditionally test stuff', function() {
$$('table tr').count().then(function countRows(count) {
if (count > 0) {
// data exists
} else {
// no data found
}
});
});
Upvotes: 1