mailosaur / cypress-mailosaur

Mailosaur email and SMS testing commands for Cypress

Home Page:https://mailosaur.com/docs/frameworks-and-tools/cypress/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authentication failed when using cy.mailosaurGetMessage()

raphael-leger opened this issue · comments

Hi,

When I use cy.mailosaurGetMessage, if I don't receive an email, the function throws a timeout as expected.
But if I receive an email, then a few seconds after receiving it and seeing it through the dashboard, the function crashes with Authentication failed, check your API key, which is unexpected.
How can I fix the problem?

I have correctly set up my API key in cypress.config.js, along with other configuration that work:

module.exports = defineConfig({
  env: {
    MAILOSAUR_API_KEY: "xxxx",
    // ...
  },
  // ...
});

Turns out I had set up a global cy.intercept() modifying basic auth and that conflicted with Mailosaur requests.
I reduced the scope of that intercept and Mailosaur now works as intended.