Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route and wait does not seem to work for new tabs #3

Open
rahul-winner opened this issue Mar 3, 2021 · 3 comments
Open

route and wait does not seem to work for new tabs #3

rahul-winner opened this issue Mar 3, 2021 · 3 comments

Comments

@rahul-winner
Copy link

rahul-winner commented Mar 3, 2021

first of all, thanks a lot for this wonderful piece of code.

I have used it my project and it works like charm.
I'd like to share some of my observations that I think can help.

  • I am using wait and route in my test cases. And I observed that these 'Cypress' methods do not work on tabs. For example when using route I am not able to intercept the XHR requests made from the tab.

  • Also I noticed that visit cease to work correctly on original window after we close the tab.

Can you please share your thoughts? Or if this is something that you already aware of?

Kindly let me know if I need to provide more information or if I can be of any help.

Thanks again !

Note: We are on Cypress 4.x and that's why we are still using route and did not switch yet to intercept.

@rahul-winner
Copy link
Author

Can someone please help here? Thank you.

@frnc07
Copy link

frnc07 commented Nov 3, 2021

Great piece of code, thank you very much for this module.

I am trying to use cy.on('window:confirm', () => true) when a popup window appears on newly opened tab but it doesn't work. Any idea why?

@jakedowns
Copy link
Owner

first of all, thanks a lot for this wonderful piece of code.

I have used it my project and it works like charm. I'd like to share some of my observations that I think can help.

  • I am using wait and route in my test cases. And I observed that these 'Cypress' methods do not work on tabs. For example when using route I am not able to intercept the XHR requests made from the tab.
  • Also I noticed that visit cease to work correctly on original window after we close the tab.

Can you please share your thoughts? Or if this is something that you already aware of?

Kindly let me know if I need to provide more information or if I can be of any help.

Thanks again !

Note: We are on Cypress 4.x and that's why we are still using route and did not switch yet to intercept.

Hey! glad to hear you were able to get some use out of these helpers.

I only tested these on Cypress v5+, and (they're up to 11 now, with 12 coming soon? wow!)

i never tested with the wait or route/intercept commands,
my guess tho, would be in a similar way to how i've overwritten the built-in cy.visit to accept an extra tab_name parameter, you could overwrite those other two commands in a similar fashion, to specify which tab should be targeted for those contexts. Tho i would've imagined just doing a switchTab and then calling them would've applied the wait/route/intercept to the correct context

i can maybe look into this further if it'd still be helpful to you or anyone else

as for "returning" to the root window, if you supplied a tab_name to cy.visit, you should be able to switch back after closing the other tab by using switchToTab('whatever you named your root') it's name is "root" by default, so switchToTab('root') if you never gave the visit a tab_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants