Last active
March 21, 2021 01:51
-
-
Save hvaandres/64b86dd4b1a29f863d7a981d5d9a32ca to your computer and use it in GitHub Desktop.
How to bypass Plaid within Cypress.io
This file contains hidden or 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
#To Look at the Plaid iFrame, you should look into this website https://plaid.com/demo/?utm_source=google&utm_medium=search&utm_campaign=Search_G_Non-Brand_DSA&utm_content=Plaid.com&utm_term=&utm_creative=499104059499&gclid=Cj0KCQjwutaCBhDfARIsAJHWnHv3PEKZXa3bzupUbBp63jBHtob8aFTTVGLYPsug5t2SEtMGbZuEX2waAv8qEALw_wcB&countryCode=US&language=en&product=transactions | |
describe('Plad Testing', () => { | |
it('Request Loan', () => { | |
cy.get('https://plaid.com/demo/?utm_source=google&utm_medium=search&utm_campaign=Search_G_Non-Brand_DSA&utm_content=Plaid.com&utm_term=&utm_creative=499104059499&gclid=Cj0KCQjwutaCBhDfARIsAJHWnHv3PEKZXa3bzupUbBp63jBHtob8aFTTVGLYPsug5t2SEtMGbZuEX2waAv8qEALw_wcB&countryCode=US&language=en&product=transactions) | |
cy.get('iframe#plaid-link-iframe-1', { timeout: 30000 }).then(iframe => { | |
cy.wrap(iframe) // from Cypress blog ref above | |
.its('0.contentDocument.body') | |
.should('not.be.empty') // ensure the iframe body is loaded | |
.as('iframeBody') // save for further commands within iframe.body | |
//.contains('button', 'Continue', { timeout: 10000 }) // returns 2 buttons! | |
.find('button#aut-continue-button', { timeout: 10000 }) // this is the best selector | |
.click() | |
let plaid_choose_bank = cy.get('@iframeBody') | |
plaid_choose_bank | |
.contains('h1', 'Select your bank') // confirm the result of the click() | |
.xpath('/html/body/reach-portal/div[3]/div/div/div/div/div/div/div[2]/div[2]/div[2]/div/ul/li[1]/button/div/div[2]/p[1]').click() | |
let plaid_bank_username = cy.get('@iframeBody') | |
plaid_bank_username | |
.find('input[name="username"]').type('user_good', { delay: 100 }) | |
let plaid_bank_password = cy.get('@iframeBody') | |
plaid_bank_password | |
.find('input[name="password"]').type('pass_good', { delay: 100 }) | |
let plaid_bank_button = cy.get('@iframeBody') | |
plaid_bank_button | |
.find('button#aut-submit-button').click() | |
let plaid_account_option = cy.get('@iframeBody') | |
plaid_account_option | |
.contains('Plaid Checking').click() | |
let plaid_bank_button2 = cy.get('@iframeBody') | |
plaid_bank_button2 | |
.find('button#aut-continue-button') | |
.click() | |
let plaid_bank_allow = cy.get('@iframeBody') | |
plaid_bank_allow | |
.find('button#aut-continue-button') | |
.click() | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment