如何用量角器来处理纱厂 [英] How to handle Spinners using Protractor
问题描述
在我的AngularJS应用,任何页面加载,有两件事加载
第一页和第二部分的后端资源的内容。
而后端资源加载,一个微调进来前,用户无法对页面内容做任何事情。
In my AngularJS application, for any page to load, there are two things which are loading First the content of the page and secondly some back-end resources. While back-end resources are loading, a spinner comes in the front and user is not able to do anything on the page contents.
现在,当我使用编写应用程序的自动化测试套件的量角器,我无法找到一个方法,等待的微调从消失屏幕开始测试前。
Now while I am writing the automation test suites of the application using Protractor, I am not able to find a technique, to wait for the spinner to disappear from the screen before starting the test.
请帮我在这。
推荐答案
IsDisplayed
如您在安德烈斯D的评论中提及了应该使用适合自己情况的正确的。但是,它返回一个承诺,所以你不能只用
IsDisplayed
as you mentioned in Andres D's comment should be the right one to use for your situation. However, it returns a promise so you cant just use
的回报!$('微调')。isDisplayed()
因为这将只是始终返回false。
since that will just always return false.
尝试以下,看看是否可行。
Try the below and see if it works.
browser.wait(function() {
return $('.spinner').isDisplayed().then(function(result){return !result});
}, 20000);
这篇关于如何用量角器来处理纱厂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!