2016-04-15 6 views
3

私のアプリケーションのログインシステムをテストするための機能テストを書いています。私はfillField()を使用する以下の方法を試しましたが、それは私のために働くことができませんでした。私は上の登録フォームを持っている、ということに留意すべきで機能テストのfillField()の作成方法Codeception + Laravel 5.2

Step I see in form fields "form[name=loginForm]",{"email":"[email protected]","password":123456} 
Fail Failed asserting that `[email protected]` is in input's value: array (
    0 => '', 
) 
Failed asserting that an array contains '[email protected]'. 

ポイント:私はseeInFormFields()方法、そのエラーの下に私を与えるを実行しようとした

その後
$I->fillField(['id' => 'loginEmail'], '[email protected]'); 

$I->fillField("//input[@id='loginEmail']", '[email protected]'); 

、同じnameを持っている同じページ、なぜ私はIDを使用しなければならなかったか。

ご協力いただきありがとうございます。 HTMLのコードの下

WITH

UPDATEは、最初のパラメータは、あなたがここに多くのテストスクリプトを見つけることができます

$I->fillField('email', '[email protected]'); 

フィールドの文字列名である私のHTMLフォームのコード

<form name="loginForm" class="" method="POST" action="https://domain/en-us/checkout/login"> 
     <div class="col-sm-12 wrapper generic-form collapse-form" ng-controller="mobileController"> 
      <fieldset> 
       <legend 
        class="legend-login"> 
        I have an account 
       </legend> 
       <div class="collapse-panel"> 
        <div class="col-xs-12 control-group"> 
         <div class="row form-group" ng-class="{ 'has-error' : loginForm.email.$error.required && submitted }"> 
          <div class="col-sm-4 col-xs-12 text-right"> 
           <label for="email">E-Mail</label> 
          </div> 
          <div class="col-sm-8 col-xs-12"> 
           <input 
             name="email" 
             type="email" class="form-control" 
             id="loginEmail" 
             required> 
           <small class="ico-buttons ico-error red"> 
            Mandatory 
           </small> 
          </div> 
         </div> 
        </div> 
        <div class="col-xs-12"> 
         <div class="row form-group" ng-class="{ 'has-error' : loginForm.password.$error.required && submitted }"> 
          <div class="col-sm-4 col-xs-12 text-right"> 
           <label for="password">Password</label> 
          </div> 
          <div class="col-sm-8 col-xs-12"> 
           <input name="password" 
             type="password" 
             class="form-control" 
             id="password" 
             required> 
           <small class="ico-buttons ico-error red"> 
            Mandatory 
           </small> 
          </div> 
         </div> 
        </div> 
        <div class="col-xs-12"> 
         <div class="row form-group"> 
          <div class="col-xs-12 col-sm-8 col-sm-offset-4"> 
           <input type="button" value="Login" name="submitWelcomeLoginForm"> 
          </div> 
         </div> 
           <br> 
           <a href='https://domain.com/' class='pull-right'>Forgot Password?</a> 
        </div> 
       </div> 
      </fieldset> 
     </div> 
     <div class="clearfix"></div> 
    </form> 
+0

質問のフォームのHTMLを追加できますか? – Naktibalda

+0

@Naktibaldaあなたは私のHTMLコードを見ましたか? –

答えて

0

です:https://github.com/satrun77/tinyissue/blob/master/tests/functional

テストスクリプトは、それがseeInFormFieldsが満たされた値が表示されません、それが唯一のページの元のHTMLに存在する値を見ることである
、あなたの問題はfillFieldが動作しないということではありませんfillField https://github.com/satrun77/tinyissue/blob/master/tests/functional/CrudIssueCest.php

+0

http://codeception.com/docs/modules/Laravel5#fillFieldをご覧ください。私はまた、配列のようにそれを使用し、他のパラメータを使用することができます右? –

0

を使用しました。

+0

あなたはどういう意味ですか? –

+0

seeInFormFieldsを使用しないでください。フォームの送信に問題がありますか? – Naktibalda

+0

はい、私はすでにそれを試み、エラーがあります。 –

関連する問題