【问题标题】:zombie : ajax call don't work僵尸:ajax 调用不起作用
【发布时间】:2016-12-08 23:58:59
【问题描述】:

我正在使用 behat/mink 和zombie.js 进行测试。 到目前为止,一切都运行良好,直到我想测试一个 ajax 调用。 我正在使用 API (fixer.io) 进行货币兑换。这部分效果很好:用户选择原始货币,项目数量,设置价格,金额自动转换为欧元。

在我的 js 测试 中,我填写了每个字段,用户应该会看到原始货币的金额 + 欧元兑换的金额。但转换后的金额不会显示在页面上:ajax 调用总是返回错误。 然后我看到了这个问题https://github.com/assaf/zombie/issues/417

绝对没有办法用僵尸测试 xhr 同步?

【问题讨论】:

    标签: ajax zombie.js


    【解决方案1】:

    已通过此答案 How do I return the response from an asynchronous call?Use Promises 部分解决 并且通过告诉 behat 等待我的 ajax 回调。

    /**
    * @Given I wait
    */
    public function iWait()
    {
        $this->getSession()->wait(5000);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      • 1970-01-01
      • 2017-10-16
      • 2011-10-15
      • 1970-01-01
      相关资源
      最近更新 更多