- getting started
- Get Started with Automating Web Applications
- Get Started with Automating Mobile Web Applications
- Get Started with Automating Android Apps
- Get Started with Automating iOS Apps
- Get Started with REST API Testing
- test cases
- web apps
- How to create web application tests using Test Recorder
- How to create Test Steps for uploading files
- mobile apps
- How to create Android & iOS app tests using Test Recorder
- How to automate Android app tests using local devices
- How to automate iOS app tests using local devices
- How to automate data driven testing
- REST API
- What is JSONPath and How to query JSON using JSONPath
- Contract Testing with Testsigma
- Consumer Driven Contract Testing with Testsigma
- test plans
- How to create test plans to run on your local devices
- How to do cross-platform end-to-end testing with Testsigma
How to automate email based Two Factor Authentication(2FA)
Prerequisites
Steps for email-based 2FA automation
Step 1: Record elements
Before moving on to the test case, you must capture elements on the login screen of your application. For more information on how to record elements using Testsigma chrome recorder extension, refer to
Step 2: Configure the mailbox
Testsigma provides you with a valid mailbox on request, with which you can author any test case that requires a valid mailbox connected to an email id.
The 2FA testing (email and phone number) is offered as part of the enterprise plan. The feature is available for the below mentioned countries & supported for SMS OTP.
Australia, Canada, USA, Czech Republic, Denmark, Hungary, Indonesia, Mexico, Netherlands, Romania, Slovakia, Sweden, United Kingdom. For other regions, contact sales.
Step 3: Create a test case
If you are not familiar on how to create a simple test case, refer to create a testcase
Step 4: Create a test steps to enter the email address where the OTP is to be sent
We will enter the email address provided by Testsigma using the Mailbox test data type in the test step.
- In your test case, add a test step to enter the email in the email field on your application page.
- Clear the test data placeholder and select the &|Mailbox| test data type from the suggestions list. An overlay showing the list of available Email addresses will open up.
- Next, use the NLP Click on SendOTPto generate the OTP.
Step 5: Create a test step to fetch the OTP from the mailbox
We will use the test data generators available in Testsigma to fetch the OTP from the Mailbox selected in the previous step.
- Add a test step to enter the OTP Code in the OTP Field. For this, select the NLP Enter test data in the EmailOTP field
- Clear the test data placeholder and select the !|Function| test data type
- Search and select the Test Data generator function !|MailboxFunctions - getOTP|
- Enter the below arguments for the function and create the test step.
- Regex: The Regex command specifies the format of the OTP i.e alphanumeric or pure number or pure alphabetical etc. For example: for an OTP which is a number with a length of 4 to 8, we can use the regular expression \d{4,8}.
- Mailbox: The Mailbox is the pre-configured email ID to which the OTP is sent. In this case it is automation@testsigatech.com
- Timeout: How long should be the wait time for the OTP to be generated
- Once these values are passed the MailBox reader will use the parameters to read the generated OTP.