AngularJS e2e tests hang when changing between two separate angular apps

て烟熏妆下的殇ゞ 提交于 2019-12-22 19:31:16

问题


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?


回答1:


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.

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

browser.ignoreSynchronization = true;

and

browser.sleep( ... );

The tests now work as expected.



来源:https://stackoverflow.com/questions/22548366/angularjs-e2e-tests-hang-when-changing-between-two-separate-angular-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!