在Mink中测试Stripe.js时,信用卡号显示为乱码

问题描述

我正在尝试使用Behat / Mink在我的Drupal网站上测试Stripe。

我已配置了Stripe测试付款网关。我的

我的FeatureContext.php看起来像这样:

  /**
   * @Then I enter my US JCB credit card info
   */
  public function iEnterMyUsJcbCreditCardInfo() {
    $this->enterCardDetails('3566 0020 2036 0505','11 / 21','777');
  }

  private function enterCardDetails($card_number,$exp_date,$cvc) {
    $this->getSession()->wait(2000);
    // Switch to the payment iframe.
    $this->getSession()->switchToIFrame(self::STRIPE_CARDNO_IFRAME);
    $this->getSession()->wait(1000);
    $this->fillField('cardnumber',"$card_number");
    $this->getSession()->wait(2000);

我添加了wait(),因为信用卡号填写不正确。

例如,当我执行步骤And I enter my US JCB credit card info时,我得到的是3566 0000 3605 5022,而不是正确的测试卡号(3566 0020 2036 0505)。

invalid card number with behat

卡号不正确;当我重新运行测试三次时,我得到了这些数字:

  • 3566 0022 3005 5600
  • 3566 0002 0360 5502
  • 3566 0006 5500 3220

因此,似乎stripe.js出现了一些问题,干扰了我的信用卡号输入。

信用卡有效期和CVC /安全码输入不存在此问题。

当我消除信用卡号中的空格时,我仍然遇到相同的问题(输入时数字随机乱码)。

即使我将输入卡号前后的等待时间分别设置为5秒,卡号仍然会出现乱码。

如何在不破坏信用卡号的情况下以behat / mink输入信用卡号?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)