本文介绍了Angular2 e2e测试用例,带有量角器抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 angular2-webpack-starter 创建了我的应用,并且我已经使用了 socket.io .我创建了一个通用服务来创建套接字连接并监听其方法.用户登录后将使用并初始化此服务.当应用程序运行且我执行测试用例登录时,我正在使用以下代码检查url:

I have created my app with angular2-webpack-starter and i have used socket.io with it. I have created one common service to create socket connection and listen its method. this service is used and initialized after user is logged in. When app is running and i execute test case for login, i am checking url with below code :

browser.getCurrentUrl().then((url) => {
    expect(url).toEqual('/dashboard');
});

问题是当套接字连接时,其抛出错误"15秒后等待量角器与页面同步超时",并且如果套接字未连接,则相同的测试用例正在运行,没有任何错误.

The issue is when socket is connected its throwing error 'Timed out waiting for Protractor to synchronize with the page after 15 seconds' and if socket is not connected same test case is running without any error.

推荐答案

我不确定连接到套接字是否实际上会花费更长的时间,但是如果15秒还不够,您可以更改allScriptsTimeout:timeout_in_millis在量角器配置文件中

I'm not sure if connecting to the socket is actually make things take longer or not but if the 15 seconds isn't enough time, you can change theallScriptsTimeout:timeout_in_millis in your protractor configuration file

量角器超时

这篇关于Angular2 e2e测试用例,带有量角器抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 08:52