Home > Enterprise >  I need to create automation test in cypress that will register user with different emails and accept
I need to create automation test in cypress that will register user with different emails and accept

Time:11-04

Until now I was using MailSlurp for this task but it has limits when using the basic plan. enter image description here

Is there any other free tool/way that would solve the problem? What do you propose?

Test Case Steps:

  1. Register user with random email
  2. Go to the created email address and click the activation link sent by the app

CodePudding user response:

You can use faker to generate a random word and then just add that word to the end of your email with a it would look something like this

cy.get('someElement').type(`something ${faker.random.words(1)}@example.com`);

Then you can just navigate to your own email address and click the link from there. The only issue you are going to have is that you wont be able to do this all is the same test case as cypress does not support cross browser testing.

Also Im not sure if the activation link redirects you or not, but if it does you wont be able to navigate to that link either.

Here is an awesome article showing how you can use MailTrap to do this: https://humble.dev/testing-an-email-workflow-from-end-to-end-with-cypress

CodePudding user response:

I found the solution. I used a small library called gmail-tester https://www.npmjs.com/package/gmail-tester, and it does its job perfectly.

I've had a problem with configuring it but in the end, it's working.

I can check now has user received an email, and assert the content of the emails.

  • Related