We can use cy.state('window')
to get window
object synchronously. The command can also be used to store arbitrary state (example).
E.g. within cy.intercept
:
cy.intercept('GET', '/test', (req) => {
const win = cy.state('window');
// do something with the window
})