I want to open a new window and create one fake email address in that window. after that I want to close that window.
Here is what I have tried.
it.only('Sign up', function () {
cy.visit('/')
cy.xpath('//button[text()=" Sign Up with Email"]').click()
cy.get('#email').type(email.toLocaleLowerCase())
cy.fixture("data.json").then(profile => {
profile.email = email
cy.writeFile("cypress/fixtures/data.json", profile);
cy.window().then((win) => {
cy.stub(win, 'open').as('redirect');
})
cy.get('.ant-btn').click()
cy.wait(1000)
cy.get('@redirect').should('be.calledWith')
});
});
And here is my test runner image. the window is not called.
And if the window is open, how to use the command in that.