weixin_33725126 2016-08-03 10:10 采纳率: 0%
浏览 28

僵尸:ajax调用不起作用

I'm using behat/mink with zombie.js for testing. Everything workedwell so far, until I wanted to test an ajax call. I'm using an API (fixer.io) to convert money. This part works well : the user choose the original currency, number of items, set the price and the amount is automatically converted into euro.

In my js test with zombie, I fill every fields and the user should see the amount in original currency + converted in euro. But the converted amount doesn't show on the page : the ajax call always return error. then I saw this issue https://github.com/assaf/zombie/issues/417 .

There is absolutely no way to test xhr sync with zombie ?

  • 写回答

1条回答 默认 最新

  • 胖鸭 2016-08-03 14:15
    关注

    Resolved with the Use Promises part of this answer How do I return the response from an asynchronous call? And the by telling to behat to wait for my ajax callback.

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

报告相同问题?