如何模拟拖和量角器降行动? [英] How to simulate a drag and drop action in protractor?
问题描述
我有一个双滑块和我想测试它的操作和返回是正确的数据。滑块有一个最小和最大一个处理程序,它也有一些断点,我可以勾。
I have a double slider and I'd like to test that it's operable and return's the right data. The slider has a min and a max handler, it also has some "breakpoints that I can hook to. "
我想模拟为
- 在.handler-MAX元素 的touchStart
- 拇指与多类元素的举动.STEP-3
- 在.handler-MAX元素 的touchEnd
- a touchStart of the ".handler-max" element
- a move of the thumb over the element with class ".step-3"
- a touchEnd of the ".handler-max" element
而我发现如何引发touchStart和touchEnd事件。我对如何模拟拇指移动无能
while I found how to trigger a touchStart and a touchEnd event. I'm clueless on how to simulate the move of the thumb
browser.executeScript('angular.element(arguments[0]).triggerHandler("touchstart");', filterHandler);
// <--- move event????
browser.executeScript('angular.element(arguments[0]).triggerHandler("touchend");', filterHandler);
P.S。这个问题的范围是一个集成测试,测试,如果发生了什么应用程序在用户交互与双滑块指令是理想的结果。
P.S. The scope of this question is an integration test that tests if what happens to the application when a user interact's with a double slider directive is the desirable result.
推荐答案
ELEM =元素要移动;
elem = Element you want to move;
要砸ELEM目标=元素;
target = Element where you want to drop elem;
有关WebdriverJS: -
For WebdriverJS:-
browser.driver.actions().dragAndDrop(elem,target).mouseUp().perform();
有关量角器: -
browser.actions().dragAndDrop(elem,target).mouseUp().perform();(Protractor)
这篇关于如何模拟拖和量角器降行动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!