douwuli4512 2015-08-03 05:36
浏览 98
已采纳

提交带有Codeception的表单时无效的cookie

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.

  • 写回答

1条回答 默认 最新

  • duanlanzhi5509 2015-08-06 08:59
    关注

    So it turned out it was a bug, which is now fixed. Version 2.1 should have it working like a charm. For more information please check out https://github.com/Codeception/Codeception/issues/2234

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题