离子3无限滚动模拟e2e测试茉莉/量角器 [英] Ionic 3 infinite-scroll simulate in e2e test jasmine/protractor

查看:107
本文介绍了离子3无限滚动模拟e2e测试茉莉/量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你去这里:



然后在控制台中输入: $ 0.scrollIntoView( )



永远不会触发无限滚动。



有没有办法在量角器上下文中以编程方式触发无限滚动?

解决方案

你的例子中滚动的实现依赖于滚动的速度/速度,当我调用 scrollIntoView 时,我认为它远远低于预期范围。



一种解决方法是通过在合理的时间内发出多个滚动事件来模拟平滑滚动。我们的想法是尽可能地重现真实用户的行为。



有些浏览器已经通过 scrollIntoView (Chrome 62支持):

  $ 0.scrollIntoView({behavior:smooth,block:end}); 


If you go here: http://ionicframework.com/docs/api/components/infinite-scroll/InfiniteScroll/

Inspect the demo and click the last item on the list:

Then in the console type: $0.scrollIntoView()

Infinite Scroll is never triggered.

Is there a way to programmatically trigger infinite-scroll in protractor context?

解决方案

The implementation of the scroll in your example rely on the speed/velocity of the scroll which I guess falls far from the expected range when scrollIntoView is called.

One workaround is to simulates a smooth scroll by emitting multiple scroll events over a reasonable time. The idea is to reproduce as close as possible the behavior of a real user.

Some browsers already provides the option via scrollIntoView (supported by Chrome 62) :

$0.scrollIntoView({behavior: "smooth", block: "end"});

这篇关于离子3无限滚动模拟e2e测试茉莉/量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆