Coder Social home page Coder Social logo

cypress-mailslurp's People

Contributors

grandadevans avatar jackmahoney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cypress-mailslurp's Issues

Issue with cy.mailslurp() command causing SyntaxError

Encountering a SyntaxError when using cy.mailslurp() in a Cypress before() hook. The error suggests an unexpected token '<', indicating invalid JSON. This prevents the execution of subsequent tests. Assistance needed to resolve this issue promptly.

cy.mailslurp is not a function

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?

The ability to set timeouts on the cy.mailslurp().then(...) call

Currently we have to set the default timeouts in cypress config to exorbitantly high values which affects all assertions in the test suite - not just the email-related assertions.

i.e.

// cypress.config.ts
export default defineConfig({
  defaultCommandTimeout: 60000,
  responseTimeout: 60000,
  requestTimeout: 60000,
  ...

Cypress typically allows consumers to set timeouts on .then chains w/ an options object.

i.e.

cy.get('something').then(
  { timeout: 60000 }, // first arg can be an options object instead of the callback
  () => {
    // make assertions
  }
)

It'd be beneficial if this library could allow for the same one-off setting of timeouts so default timeouts of the test suite don't need to be set for the sole purpose of mailslurp assertions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.