I'm trying to test my project with Codeception (acceptance tests). Everything was going fine until I had to submit a form with Paypal button.
When debugging it shows
I submit form "form:nth-child(3)",
[Uri] https://www.sandbox.paypal.com/cgi-bin/webscr
[Method] POST
[Parameters] {"cmd":"_s-xclick","hosted_button_id":"BUTTONID"}
ERROR
And then goes
[RuntimeException] Invalid cookie: The cookie value must not be empty
I DO NOT set any cookies during the test. And have no clue why is it firing this error up.
Here's my acceptance.suite.yml
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: http://test.mysite.com
- \Helper\Acceptance
Here's my SubscriptionCest.php:
<?php
use \AcceptanceTester;
class SubscriptionCest
{
public function _before(AcceptanceTester $I)
{
}
public function _after(AcceptanceTester $I)
{
}
// Main function
public function run(AcceptanceTester $I)
{
$I->am("New user");
$I->wantTo("purchase a membership");
$I->amOnPage("/subscription");
$I->submitForm("form:nth-child(3)", []);
}
}
And here's the HTML of that paypal form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="BUTTONID">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Why does this error happen and how to resolve this problem? Thanks.