Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

What about if you had no "ng-model"s ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top