如何讓量角器在桌面上向下滾動?我的表進行無限滾動 - 它加載了20條記錄,當顯示倒數第二行時,它會取出下面的20條記錄。並非所有記錄都在視圖中...有些視頻尚未滾動,有些則在用戶滾動瀏覽視頻時處於上方。我在考慮測試是量角器:滾動表格並測試無限滾動
it('should fetch next set of records on scroll') {
element.all(by.id('users')).map(function (elm) {
return elm;
}).then(function (users) {
expect(users.length).toBe(20);
});
// Scroll the table to the bottom to trigger fetching more records
element.all(by.id('users')).map(function (elm) {
return elm;
}).then(function (users) {
expect(users.length).toBe(40);
});
};
這是做這個的正確方法嗎?
HTML表格代碼:
<div ng-if="users && users.length > 0" class="table-scroll" ng-infinite-scroll="loadMoreUsers()">
<table id="users-table" class="table table-hover text-overflow-ellipsis">
<thead>
<td class="col1"></td>
<td id="users-table-name-col" class="col2">User</td>
<td id="users-table-date-col" class="col3">Birthday</td>
</thead>
<tbody ng-repeat="group in users">
<tr ng-repeat="user in group.users" ng-click="userClicked(user);">
<td class="col1">
<img class="col-xs-1 profile-picture" style="padding:0" ng-src="{{user.profile_picture}}"></td>
<td class="col2">
<div id="user-name"> {{ user.last_name }}, {{ user.first_name }} </div>
</td>
<td class="col3">
<div id="user-date"> {{user.date}} </div>
</td>
</tr>
</tbody>
</table>
</div>
顯示您的表的代碼 –