My Form contain a hidden field csrf and my Controller has a method to check CSRF attack. In my functional test, I tried by fillField to check my Controller's method redirect to specific page if someone temper form. I read somewhere that codecept works only with visible field.
This is the only system which worked for me :
$I->executeJS('$(".yourMethodClass").val("YOUR_VALUE_HERE");');
Of course u can call it by ID or any javascript selectors u want.
You can use fillField for hidden inputs. I use it in my tests and it works just fine, it properly fills value of hidden input.
$I->fillField(['name' => 'email'], 'some email');
$I->fillField(['name' => 'password'], 'myPassword');
$I->fillField('privilegesList','read'); //this is hidden input
$I->click('submit button');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With