I am trying to create a E2E test using angular-js and karma, but for some reason the test is not progressing and hangs on the navigateTo().
the code I am using is
describe('Login', function(){
beforeEach(function(){
browser().navigateTo('http://localhost/blah');
window.sleep(1);
});
it('should log in a user and redirect', function(){
input('email').enter('user');
input('password').enter('pass');
element(':button').click();
expect(browser().location().url()).toBe('/newBlahPage');
});
});
the html mark up is
<form action="" method="">
<input type="test" name="email" id="email />
<input type="password" name="pass" id="pass" />
<button type=""submit">login</button>
</form>
I'm not sure if it is the test its self or the server side authenticate or if I am just missing something I have thought of yet.
You have to change your form like this;
<form action="" method="" ng-submit="somefunctionname">
<input type="test" name="email" id="email" ng-model="email" />
<input type="password" name="pass" id="pass" ng-model="pass"/>
<button type=""submit">login</button>
</form>
Then write your test case as above. I think this will help.
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