Search code examples
javascripttestingstripe-paymentscypressend-to-end

How to get stripe element in cypress


I want to write end-to-end tests for web-application on Ionic with stripe-payments and have problem to type card number in stripe iframe field.

I checked Testing Stripe Elements with Cypress to understand how to do this stuff, but it doesn't work.

I have this structure of my HTML:

Screenshot of my structure:

Screenshot of my structure

Can you have any idea how to do this?


Solution

  • The cypress-plugin-stripe-elements plugin should work:

    This plugin provides a fillElementsInput that makes it easy to fill out Stripe Elements inputs without cy.wait() hacks or anything else.

    cy.fillElementsInput('cardNumber', '4242424242424242');