私のアプリケーションのログインシステムをテストするための機能テストを書いています。私は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>
質問のフォームのHTMLを追加できますか? – Naktibalda
@Naktibaldaあなたは私のHTMLコードを見ましたか? –