AngularJS端到端测试两个不同角度的应用程序之间切换时挂应用程序、端到、角度、不同

2023-09-13 03:39:09 作者:逆天↘浪子

我有一个令人沮丧的问题:我想写端到端的复杂应用程序的角度测试。问题是,在登录屏幕是一个单独的应用程序。最初的想法是,它将分支分离基础上的登录凭据,在我们的生态系统其它角度的应用程序。它的工作原理就像一个魅力。对于测试中,它是一场噩梦,但。

I have a frustrating problem: I want to write end to end tests for a complex angular app. The problem is that the login screen is a separate app. The initial idea was that it would branch out to separate other angular apps in our ecosystem based on the login credentials. It works like a charm. For the tests it is a nightmare though.

测试工作,如预期,但只要输入正确的凭据和主要应用程序的角度加载测试只是超时。没有错误消息或调试任何输出,它只是在等待。我可以看到页面加载正确。

The tests work as expected but as soon as correct credentials are entered and the main angular app is loaded the tests just time out. No error message or debug output whatsoever, its just waiting. I can see the page is loading correctly.

现在我想我会跳过目标应用这部分测试右但那不是任何工作,因为我需要初始化用正确的凭据先在服务器(=通过登录屏幕)。

Now I thought I would skip this part and test right on the target app but thats not working either since I need to initialize the server with the right credentials first (= go through the login screen).

我想这与因果报应的场景亚军和量角器,都显示了完全相同的行为。我可以告诉他们重新初始化目标页面加载后?

I tried this with the karma scenario runner and protractor, both show the exact same behavior. Can I tell them to reinitialize after the target page is loaded?

推荐答案

所以,当量角器超时,错误信息显示的链接的常见问题。右顶部有这个问题的解释。显然,应用程序发送的请求不断(也许是因为我使用socket.io),所以角永远不会结束。

So when protractor times out, the error message shows a link to the faq. Right on top there's the explanation for this problem. Apparently the app sends continuous requests (maybe because I am using socket.io), so Angular is never finished.

这问题无关的独立应用程序。

This problem has nothing to do with the separate apps.

借助问题链接是非常有益的。因为我不愿意触及任何页面code我解决的。

The issue link was very helpful. Since I am not willing to touch any of the pages code I settled with

browser.ignoreSynchronization = true;

browser.sleep( ... );

测试现在正常工作。

The tests now work as expected.