I have a simple e2e test to verify that route redirection works
<!doctype html>
<html lang="en">
<head>
<title>End2end Test Runner</title>
<script src="../client/components/angular-scenario/angular-scenario.js" ng-autotest></script>
<script src="e2e/scenarios.js"></script>
</head>
<body>
</body>
</html>
'use strict';
describe('e2e', function() {
beforeEach(function() {
browser().navigateTo('../../client/index.html');
});
it('should redirect to the main application home page with / is accessed', function() {
browser().navigateTo('#!/');
expect(browser().location().path()).toBe('/app');
});
});
*snip*
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'./test/e2e/**/*.js',
];
*snip*
When this gets run, browser().location().path() will raise an exception:
TypeError: 'undefined' is not a function (evaluating '$document.injector()')
I've determined it's the .path() at the end that's causing the issue since if I do browser().location() no exception is raised.
However in the browsers console this will return a angular.scenario.Future as expected.
Why is an exception being raised?
From the top of my head, here are the top reasons for AngularJS E2E tests not working
Hope one of these does the trick for you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With