相关疑难解决方法(0)

Cypress 12.8.1 无法与 Stripe Elements iframe 配合使用

我已经被困在这个问题上很多年了,不知道如何让 Cypress 12.8.1 与 Stripe 元素一起工作来输入信用卡详细信息并创建付款。

我已经在互联网上搜索过,但似乎没有一个解决方案有效。

任何帮助是极大的赞赏。

我努力了:

  1. 使用 xpath https://www.browserstack.com/guide/frames-and-iframes-in-cypress这对我来说不起作用。查看错误:https://github.com/cypress-io/cypress/issues/24764#issuecomment-1489438851 在此输入图像描述

  2. 尝试过这个插件,但它不再起作用了。/sf/answers/4901746671/ https://github.com/dbalatero/cypress-plugin-stripe-elements

  3. 尝试过这个但出现以下错误。

    const $body = $element.contents().find('body')
    let stripe = cy.wrap($body)
    stripe.find('input[name="number"]').click().type('4242424242424242')
    stripe = cy.wrap($body)
    stripe.find('input[name="expiry"]').click().type('4242')
    stripe = cy.wrap($body)
    stripe.find('input[name="cvc"]').click().type('424')
})
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  1. 尝试了添加自定义 Cypress 命令“iframeLoaded”的几个版本,但我不知道如何在新的 Cypress 12 打字稿格式中添加这些命令,并且只是收到错误。 https://medium.com/@michabahr/testing-stripe-elements-with-cypress-5a2fc17ab27b https://bionicjulia.com/blog/cypress-testing-stripe-elements

我的代码位于 support/commands.ts

// ***********************************************
// This example namespace declaration will help
// with Intellisense and code completion in your
// IDE or Text Editor.
// ***********************************************
declare namespace Cypress {
  interface Chainable<Subject = any> {
    iframeLoaded($iframe: …
Run Code Online (Sandbox Code Playgroud)

stripe-payments angular cypress

13
推荐指数
1
解决办法
2290
查看次数

标签 统计

angular ×1

cypress ×1

stripe-payments ×1