JSPM

cypress-temp-sms

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q56089F
  • License ISC

Provides temporary mobile numbers for SMS testing with Cypress

Package Exports

  • cypress-temp-sms
  • cypress-temp-sms/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cypress-temp-sms) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cypress-temp-sms

A lightweight npm library designed to generate temporary mobile numbers that shall be used for SMS verification as part of end-to-end testing with Cypress. It streamlines the process of testing OTP,2FA -related functionalities in your applications.

Disclaimer:

In this plugin, we are using https://receive-smss.com/ to generate temporary numbers and read its SMS inbox. Please note that these are several disposable numbers are to be used only for testing activities

Features

  • Quick Setup: Easily integrate with your Cypress tests.
  • Disposable mobile numbers: Generate temporary mobile numbers for testing sign-ups, password resets, and more.

Installation

Install cypress-temp-sms using npm:

npm install cypress-temp-sms --save-dev

Usage

Add below line in your Cypress project - cypress/support/commands.js

require('cypress-temp-sms')

Generate a new temporary number:

cy.getRandomNumber()  
//Returns you a temp number generated using https://receive-smss.com/

Generate a new temporary number with specific country:

cy.getNumberFrom('India')  
//Returns you a temp number generated using https://receive-smss.com/

Get the SMS inbox for the genrated number:

cy.getSMS('+123456789') 
//Returns below array object for the SMS inbox data.
{ sender: string, message: any, received: string }[]

Contributing

Contributions are welcome!