基本的に、この Web ページのテストを作成しようとしています: http://www.talklocal.com/mobile/#/step1
フォームに情報を入力して、[次へ] ボタンをクリックします。テストではフォームのステップ 2 (URL を確認) にリダイレクトされるはずですが、リダイレクトされず、代わりに失敗します。テストのコード:
describe('going from step1 to step 2', function() {
//fill out step 1 form
beforeEach(function() {
browser.get('index.html');
element(by.model('Request.categoryID')).click();
element(by.css('option[value=0]')).click();
element(by.class('where-text ng-pristine ng-valid').sendKeys('20902'));
element(by.class('btn action-button')).click();
});
it('should be on the step2 page', function() {
browser.getLocationAbsUrl().then(function(url) {
expect(url.split('#')[1]).toBe('/step2');
});
});
});
端末のエラー メッセージ:
1) myApp going from step1 to step 2 should be on the step2 page
Message:
TypeError: Object [object Object] has no method 'class'
2) myApp going from step1 to step 2 should be on the step2 page
Message:
Expected '/step1' to be '/step2'.
3 tests, 5 assertions, 2 failures
私はエラーをグーグルで検索し、要素(by.attribute)メソッドのさまざまなクラスと属性をプラグインしようとしましたが、役に立ちませんでした。
この問題に関するすべてのフィードバックをお待ちしております。ありがとう!