cypress 并不支持多 tab 切换,它的文档里已经说了:https://docs.cypress.io/guides/references/trade-offs.html#Permanent-trade-offs-1
- Cypress is not a general purpose automation tool.
- Cypress commands run inside of a browser.
- There will never be support for multiple browser tabs.
- You cannot use Cypress to drive two browsers at the same time.
- Each test is bound to a single origin.
不过它提供了解决类似问题的方案:
https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/testing-dom__tab-handling-links/cypress/integration/tab_handling_anchor_links_spec.js