Skip to content
Discussion options

You must be logged in to vote

Figured it out. The difficulty here was that I was working inside Storybook, so an iframe. Code example below if anyone finds this post in 15 years time.


cy.get('#your-iframe-locator').then(($iframe) => {
    const window = ($iframe[0] as HTMLIFrameElement).contentWindow as Window
    cy.stub(window, 'open').as('newWindow')
    cy.get('your-button-locator').click()
    cy.get('@newWindow').should('be.calledWith', 'your-url-here')
  })

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by d-kowalski07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant