I am using angularJs for our web application. To do the e2e routing scenario testing, based on tutorial, you need to do something like browser().navigateTo('../../app/index.html'). However, we are using cshtml as our main view, which is blocked from direct server browsing. So you cannot do something like browser().navigateTo('../../app/index.cshtml').
I would like the browser to navigate to the application root instead of specific file. I do something like browser().navigateTo('../../'). However, I get following error "TypeError: Cannot call method '$browser' of undefined". I think that is due to "ng-app" in index.cshtml is not included. Is there some easy way to solve this?
You can navigateTo any url, but it has to be on the same domain, because of the same domain policy (scenario runner needs to access the app within the iframe).
This can be workarounded by a proxy. Or you might serve the scenario runner (runner.html) by your app server, that might be even easier solution.
You need ng-app
, so that scenario runner can find the $injector, so even if you do manual bootstrap, put the ng-app
attribute onto the root element of the app.
I would consider possibly putting the test runner in a virtual directory off of your main testing site.