您好:我有一个Angular测试,其中包含搜索后的数据表。所以,我需要测试数据是否存在然后再做一些事情。请告诉我如何做到这一点。我还在学习如何使用"一个承诺"测试真假情况,以及从承诺中收集数据。所以,请帮助详细说明如何实现这一目标。
答案 0 :(得分:1)
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
}
});
});