Skip to main content

WhatsAppLogin

Test Cases

Test: Rendering Phone Number Input

  • Description: Ensures that users can see and type their phone numbers into the provided input field.
  • Setup: The WhatsAppLogin component is displayed on the screen.
  • Expectation: Users should be able to locate the phone number input field easily and enter their phone numbers without any restrictions.
    • Assertion 1: Verifies that the phone number input field is visible and accessible (phone-number-input).
    • Assertion 2: Confirms that the phone number input field is not disabled by default, allowing users to type in their phone numbers comfortably.

Test: Rendering Submit Button

  • Description: Verifies that users can find and click on the button to proceed with phone number submission.
  • Setup: The WhatsAppLogin component is rendered.
  • Expectation: Users should be able to identify and interact with the submit button effortlessly.
    • Assertion 1: Ensures that the submit button (confirm-phone-number-btn) is present and clearly visible.
    • Assertion 2: Confirms that the submit button is enabled by default, allowing users to click on it to proceed.

Test: Changing Valid Phone Number

  • Description: Validates the behavior when users input a valid phone number into the designated field.
  • Setup: The WhatsAppLogin component is displayed.
  • Expectation: Users should observe that the input field reflects the changes as they type in their valid phone numbers.
    • Assertion: Ensures that the phone number input field updates accurately as users type in their valid phone numbers.

Test: Disabling Input and Button on Submit

  • Description: Ensures that users cannot input or submit their phone numbers multiple times to prevent duplicate submissions.
  • Setup: The useWhatsAppOTPMutation hook is simulated to mimic the submission process.
  • Expectation: Upon clicking the submit button, users should notice that both the input field and submit button are disabled temporarily to prevent multiple submissions.
    • Assertion 1: Verifies that the phone number input field is disabled (data-disabled attribute set to 'true') during the submission process.
    • Assertion 2: Confirms that the submit button is disabled (data-disabled attribute set to 'true') to prevent additional clicks while the submission is in progress.

Test: Handling Submit Phone Number Success

  • Description: Verifies the response when users successfully submit their phone numbers for verification.
  • Setup: The useWhatsAppOTPMutation hook is mocked to simulate a successful submission.
  • Expectation: After successful submission, users should see a prompt to enter the OTP (One-Time Password) for further authentication.
    • Assertion: Ensures that the modal for entering OTP is opened as expected, guiding users through the next step of the authentication process.