This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cypress.Commands.add('signHellosignContract', () => { | |
cy.waitForHellosignContractIframe(contractFrames => { | |
cy.wrap(contractFrames[0]) | |
.contains('button', 'OK') | |
.click(); | |
cy.wrap(contractFrames[0]) | |
.contains('button', 'Get Started') | |
.click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cypress.Commands.add('waitForStripe3dIframe', callback => { | |
cy.get('iframe[src^="https://js.stripe.com/v3/three-ds-2-challenge"]') | |
.should('be.visible'); | |
cy.get('iframe[src^="https://js.stripe.com/v3/three-ds-2-challenge"]') | |
.iframe() | |
.then(iframes => { | |
cy.wrap(iframes[0]) | |
.find('iframe') | |
.should('be.visible'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cypress.Commands.add('fillOutCreditCardForm', details => { | |
cy.get('.__PrivateStripeElement > iframe') | |
.iframe() | |
.then(iframes => { | |
cy.wrap(iframes[0]) | |
.find('.InputElement') | |
.first() | |
.type(details.number); | |
cy.wrap(iframes[1]) | |
.find('.InputElement') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Will check if an iframe is ready for DOM manipulation. Just listening for the | |
* load event will only work if the iframe is not already loaded. If so, it is | |
* necessary to observe the readyState. The issue here is that Chrome initialises | |
* iframes with "about:blank" and sets their readyState to complete. So it is | |
* also necessary to check if it's the readyState of the correct target document. | |
* | |
* Some hints taken and adapted from: | |
* https://stackoverflow.com/questions/17158932/how-to-detect-when-an-iframe-has-already-been-loaded/36155560 | |
* |