Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cy.mailslurp is not a function #2

Open
vishaltps opened this issue Jan 20, 2023 · 1 comment
Open

cy.mailslurp is not a function #2

vishaltps opened this issue Jan 20, 2023 · 1 comment

Comments

@vishaltps
Copy link

I have set up everything which is there in documenation, Below is the step which I have done in my project.

Version: "cypress-mailslurp": "^1.5.0"

cypress.config.ts

      defaultCommandTimeout: 30000,
      responseTimeout: 30000,
      requestTimeout: 30000,
     env: {
       MAILSLURP_API_KEY: 'API_KEY'
     },

cypress/support/commands.ts

/// <reference types="cypress-mailslurp" />

import { MailSlurp } from 'mailslurp-client';

declare global {
    // eslint-disable-next-line @typescript-eslint/no-namespace
    namespace Cypress {
        interface Chainable {
            mailslurp: () => Promise<MailSlurp>;
        }
    }
}

cypress/support/e2e.ts

 import 'cypress-mailslurp';
 import '@cypress/support/command.ts';

cypress/e2e/authentication/authenticationActions.cy.ts

before(() => {
    cy.visit('/')
    cy.once('uncaught:exception', () => false);

    cy.log('Wrap inbox before test');
    
    return cy.mailslurp()
        .then(mailslurp => mailslurp.createInbox())
        .then(inbox => {
            cy.log(`Inbox id ${inbox.id}`)
            // save inbox id and email address to this (make sure you use function and not arrow syntax)
            cy.wrap(inbox.id).as('inboxId')
            cy.wrap(inbox.emailAddress).as('emailAddress')
            email = inbox.emailAddress;
        })
   
})

Though, i am getting same error, mailslurp is not function. can someone please help me with this?

@jackmahoney
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants