Cypress: Not able to switch to new browser tab and continue testing or directly invoking that new tab

Created on 13 Apr 2020  路  6Comments  路  Source: cypress-io/cypress

I have a scenario where on a page, it opens a new tab on clicking a span element and wanted to continue testing on that new window. The url on the new window is an encrypted dynamic one.

I had seen resource pages regarding this, but the examples are generic ones. I am still not sure how to do cy.request as mentioned in one of the solution with my case where clicking on button opens the new tab and the call happens which is rerouted through a diff system too and the url is an encoded one like ...12e6361746e6d732e636f6d$$/auth/logon?goToUrl=https%3A%2.... Not sure how can i directly do cy.request for this. Or stub this. Can you give me a specific example for doing this. Also i am not testing it on localHost, but from Jenkins.

Steps:
Login on the main screen -> while clicking on the span element button, it opens new browser tab[No call or href tag on the span element on the main screen] -> The new tab opened to login again has the above kind of call... -> Need to switch to this new tab or need to skip the first login and continue login from there and test the scenarios.

Any detail information is appreciated here.

question

Most helpful comment

I had already looked at these. None of these solutions will help us because they all talk about using href. In my case, i dont see any href tag for the button which opens a new tab. I have listed my scenario above. Until unless you provide a feature to find the open tabs and select the respective ones, we may not be able to proceed with testing. Else somehow I should be able to skip this login part and directly be in the home screen. But not sure if its possible since this login happens through another system.

All 6 comments

Issues in our GitHub repo are reserved for potential bugs or feature requests. This issue will be closed since it appears to be neither a bug nor a feature request.

We recommend questions relating to how to use Cypress be asked in our community chat. Also try searching our existing GitHub issues, reading through our documentation, or searching Stack Overflow for relevant answers.

This was an issue or a feature request since it blocks our testing using Cypress and this feature is neither supported by Cypress nor giving a proper alternative to overcome this specific issue. I had already asked this in the community channel and didn't get any resolution yet.

Example of testing sites that 'open in a new tab' is in our example recipes repo. https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/testing-dom__tab-handling-links

I had already looked at these. None of these solutions will help us because they all talk about using href. In my case, i dont see any href tag for the button which opens a new tab. I have listed my scenario above. Until unless you provide a feature to find the open tabs and select the respective ones, we may not be able to proceed with testing. Else somehow I should be able to skip this login part and directly be in the home screen. But not sure if its possible since this login happens through another system.

Even for my application I don't see any href or target attributes but when I click on the element a new Tab is opened and I have to perform some actions on the new tab to complete the testing. In this scenario none of the scenario suggested in above get repo works. Please add the support for multiple browser windows which is a critical feature for many applications

I agree with the commenters above stating that having the ability to jump to a new tab during testing would be helpful and not having that ability is very limiting.

Was this page helpful?
0 / 5 - 0 ratings