我很难计算所有元素。它一次只显示 11 个元素。向下滚动时,第一个元素被下一个元素替换。
这就是我所拥有的:
element.all(by.css('.task-virtual-scroll')).click()
browser.actions().keyDown(protractor.Key.CONTROL).sendKeys(protractor.Key.END).perform();
function StringtoNumber(promiseOrValue) {
if (!protractor.promise.isPromise(promiseOrValue)) {
// If it isn't a promise, then convert a value
return parseInt(promiseOrValue, 10);
}
return promiseOrValue.then(function(stringNumber) {
// If it is a promise, then convert the result to a number
return parseInt(stringNumber, 10);
});
}
expect(element.all(by.css('mat-card>mat-card>mat-card-header')).count())
.toEqual((StringtoNumber(element(by.css('#mat-badge-content-1')).getText())));
// Expect that the notifications are equal to the notification in the badge