3

angular-js とカルマを使用して E2E テストを作成しようとしていますが、何らかの理由でテストが進行せず、navigateTo() でハングします。

私が使用しているコードは

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');
        });
    });

htmlマークアップは

<form action="" method="">
    <input type="test" name="email" id="email />
    <input type="password" name="pass" id="pass" />
    <button type=""submit">login</button>
</form>

それがそれ自体のテストなのか、サーバー側の認証なのか、それとも私がまだ考えていたことを見逃しているだけなのかはわかりません。

4

2 に答える 2

3

このようにフォームを変更する必要があります。

<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>

次に、上記のようにテスト ケースを記述します。これが役立つと思います。

于 2013-08-17T11:35:08.953 に答える
0

「ng-model」がない場合はどうなりますか?

于 2013-09-02T09:25:18.420 に答える