Devs at my startup have switched login to a magic link system, in which you get inside after clicking a link on the email body.
I have set up a Mailsac email to receive mails containing magic links but I haven't been able to actually follow those links because of the following:
cy.request({
method: "GET",
url: "https://mailsac.com/api/addresses/[email protected]/messages",
headers: {
"Mailsac-Key": "here-goes-the-key",
},
}).then((res) => {
const magicLink = res.body[0].links[0];
cy.origin(magicLink, () => {
cy.visit('/')
});
});
I wasn't able to use cy.visit() either because the magic link URL is slightly different from the baseURL in this testing environment.
So my question is: How could I follow this cumbersome link to find myself logged in home, or else, is there another way to deal with magic links?
Thanks

The docs say
Not sure if this means the
cy.visit()argument should not have query params, of just thecy.origin()parameter.Try passing in the link
If that doesn't fix it, you could try using
cy.request()but you'll have to observe where the token is stored after using the magicLink.