我必须测试我的注册表格,但我不知道如何测试reCaptcha字段。
我收到错误:
HomeTest :: testNewUserRegistration InvalidArgumentException:没有匹配过滤器[captcha] CSS查询提供的 [http://localhost/auth/register]
这是我目前的测试:
public function testNewUserRegistration()
{
$faker = Faker\Factory::create();
$this->visit(route('auth.register'))
->type($faker->firstNameMale, 'firstname')
->type($faker->lastName, 'lastname')
->type($faker->userName, 'username')
->type($faker->email, 'email')
->attach($faker->imageUrl(), 'avatar')
->type($faker->password, 'password')
->type($faker->password, 'password_confirmation')
->check('terms')
->check('captcha')
->press('Envoyer')
->seePageIs('/');
}
在我的表格中,我声明我的验证码如下:
<div class="field {!! $errors->has('g-recaptcha-response') ? 'error' : '' !!}">
{!! app('captcha')->display() !!}
{!! $errors->first('g-recaptcha-response', '<span class="ui text" style="color: #bf4d4b">:message</span>') !!}
</div>