chovy
chovy

Reputation: 75656

How do I select a popup window in cypress?

I don't need to create a window, I need to select one that the browser automatically opened.

How can I do this in cypress?

it.only('Login with Torus', () => {
        cy.visit('http://localhost:3000/auth');
        cy.get('button.button-torus span').click();
        // need to target new popup window here from 3rd party auth
        cy.get('input#passwordless-email').type('[email protected]');
    });

This is a 3rd party auth service called Torus. https://app.tor.us/

Upvotes: 1

Views: 4036

Answers (1)

LironZ
LironZ

Reputation: 317

From Cypress Docs

Permanent trade-offs:

  • There will never be support for multiple browser tabs.
  • You cannot use Cypress to drive two browsers at the same time.

"Because Cypress runs in the browser, it will never have multi-tabs support. We do have access to the browser automation APIs to actually switch tabs, but there is no reason for us to ever expose them."

Same doc also leads to few examples on working this around:

Upvotes: 4

Related Questions