From 5b4c15775ad33f45eed150ee49af3efc26d44792 Mon Sep 17 00:00:00 2001 From: rashinarasheeed <108670558+rashinarasheeed@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:15:53 +0530 Subject: [PATCH] 2fa automation (#13) * Update sms-based-two-factor-authentication-2fa.md * created new doc for email based 2-FA * created tutorials for sms and email based 2fa --- .../email-based-two-factor-authentication.md | 82 ++++++++++++++++++ ...sms-based-two-factor-authentication-2fa.md | 83 ++++++++++++++++++- 2 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 src/pages/tutorials/advanced/email-based-two-factor-authentication.md diff --git a/src/pages/tutorials/advanced/email-based-two-factor-authentication.md b/src/pages/tutorials/advanced/email-based-two-factor-authentication.md new file mode 100644 index 0000000..282ab0e --- /dev/null +++ b/src/pages/tutorials/advanced/email-based-two-factor-authentication.md @@ -0,0 +1,82 @@ +--- +title: "How to automate email based Two Factor Authentication(2FA)" +metadesc: "Coming soon..." +noindex: true +order: 5.3 +page_id: "How to automate email based Two Factor Authentication(2FA)" +search_keyword: "Web Application, Recorder, Testsigma Tutorials" +warning: false +contextual_links: +- type: section +- name: "Contents" +- type: link + name: "Prerequisites" + url: "#prerequisites" +- type: link + name: "Steps for email-based 2FA automation" + url: "#email-based-two-factor-authentication/#steps-for-email-based-2fa-automation" +--- +--- + +## **Prerequisites** + +
  • A Testsigma account. If you do not have one already, sign up for a free trial
  • +
  • Understanding of creating and running test cases.
  • +
  • Provisioned mailbox.
  • +
  • Familiarity with regular expressions. If not, refer to Regex guide - MDN Docs.
  • +
    + +## **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 +
  • Web application
  • +
  • Android
  • +
  • iOS
  • +
    + +### **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. + +[[info | NOTE:]] +| 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. +
      +
    1. In your test case, add a test step to enter the email in the email field on your application page.
    2. +
    3. 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.
    4. +
    5. Next, use the NLP Click on SendOTPto generate the OTP. +
    6. +
    +
    + +### **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. +
      +
    1. 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
    2. +
    3. Clear the test data placeholder and select the !|Function| test data type
    4. +
    5. Search and select the Test Data generator function !|MailboxFunctions - getOTP|
    6. +
    7. Enter the below arguments for the function and create the test step. +
        +
      1. 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}.
      2. +
      3. Mailbox: The Mailbox is the pre-configured email ID to which the OTP is sent. In this case it is automation@testsigatech.com
      4. +
      5. Timeout: How long should be the wait time for the OTP to be generated
      6. +
    8. +
    9. Once these values are passed the MailBox reader will use the parameters to read the generated OTP.
    10. +
    +The below GIF depicts the method to automate email based OTP verification in real time using a sample application: +email 2fa automation + + +--- diff --git a/src/pages/tutorials/advanced/sms-based-two-factor-authentication-2fa.md b/src/pages/tutorials/advanced/sms-based-two-factor-authentication-2fa.md index 80e0163..de1c469 100644 --- a/src/pages/tutorials/advanced/sms-based-two-factor-authentication-2fa.md +++ b/src/pages/tutorials/advanced/sms-based-two-factor-authentication-2fa.md @@ -1,13 +1,92 @@ --- -title: "How to automate SMS based Two Factor Authentication(2FA)" +title: "How to automate SMS based two factor authentication(2FA)" metadesc: "Coming soon..." noindex: true order: 5.2 page_id: "How to automate SMS based Two Factor Authentication(2FA)" search_keyword: "Web Application, Recorder, Testsigma Tutorials" warning: false +contextual_links: +- type: section +- name: "Contents" +- type: link + name: "Prerequisites" + url: "#prerequisites" +- type: link + name: "Steps to automate SMS based OTP verification" + url: "#steps-to-automate-sms-based-otp-verification" + --- --- -### Coming soon... \ No newline at end of file +## **Prerequisites** + +
  • A Testsigma account. If you do not have one already, sign up for a free trial
  • +
  • Understanding of creating and running test cases.
  • +
  • Provisioned phone numbers.
  • +
  • Familiarity with regular expressions. If not, refer to Regex guide - MDN Docs.
  • +
    + + +## **Steps to automate SMS based OTP verification** + + +### **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 +

  • Web application
  • +
  • Android
  • +
  • iOS
  • +

    + +### **Step 2: Configuring your phone number** +

    +Testsigma provides you with a valid mobile phone number on request, with which you can author any test case that requires a valid phone number.

    + +[[info | NOTE:]] +| 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. + +To view the phone numbers allocated to your account, navigate to **Settings> Phone numbers**. +
    + +### **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 step to enter the phone number to which the OTP will be sent** + +We will enter the phone number provided by Testsigma using the Phone Number test data type, using a test step. +
      +
    1. In your test case, add a test step to enter the phone number in the phone number field on your application page.
    2. +
    3. Clear the < test data > placeholder and select the %|Phone Number| test data type from the suggestions list. An overlay showing the list of available phone numbers (allocated to your account) would open up.
    4. +
    5. Select one of the numbers from the list. This is the number where the OTP SMS will be sent.
    6. +
    7. Next, use the NLP Click on SendOTP
    8. +

    + + +### **Step 5: Create a test step to fetch the OTP from the SMS received on the Phone number** + +We will use the test data generators available in Testsigma to fetch the OTP from the phone number selected in the previous step. +
      +
    1. Add a test step to enter the OTP code in the OTP Field
    2. +
    3. Clear the < test data > placeholder and select the !|Function| test data type
    4. +
    5. Search and select the test data generator function !|PhoneNumberFunctions - getOTP|
    6. +
    7. Enter the following arguments for the function and create the test step. + +
    8. +Once these values are passed the PhoneNumberFuntion will use the parameters to read the generated OTP. +The below GIF depicts the method to automate email based OTP verification in real time using a sample application: +
    + + + +sms based 2fa automation +--- \ No newline at end of file