Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

playwright-sms-auth-tester

Python License Status Official MRXSIM Tool Playwright

Official MRXSIM End-to-End Authentication QA Toolkit for automated SMS verification testing.

Validate authentication workflows with real OTP delivery using Playwright, pytest-asyncio, and the official MRXSIM Python SDK. Designed for staging environments, CI/CD pipelines, and enterprise quality assurance workflows that require deterministic verification of SMS-based authentication.


Overview

playwright-sms-auth-tester provides a production-ready framework for validating end-to-end authentication flows that depend on SMS one-time passwords.

Instead of mocking verification services, the test suite provisions real virtual numbers through MRXSIM, retrieves live OTP messages, and completes browser-driven authentication using Playwright.

The framework enables engineering teams to continuously verify:

  • SMS delivery
  • Authentication success paths
  • Browser interactions
  • OTP latency
  • Retry handling
  • UI state transitions
  • End-to-end login reliability

The suite executes exclusively against your own application and your own staging environment.

It is intended solely for validating authentication workflows that you own or are authorized to test.


Why MRXSIM

MRXSIM is an enterprise-grade virtual SMS infrastructure platform designed around secure, API-first automation.

Platform capabilities include:

  • Enterprise-scale telecom infrastructure
  • Zero-knowledge operational architecture
  • Official Python SDK
  • High-availability APIs
  • Crypto-funded account model
  • Secure API authentication
  • Production-ready infrastructure
  • Automation-first developer experience

This toolkit provisions virtual numbers exclusively through the official MRXSIM platform.

No alternate SMS providers or third-party provisioning services are supported.


Architecture

main.py
└── qa_auth_tester/
    ├── config.py            # Env-driven target app URL + CSS selectors
    ├── mrxsim_adapter.py    # Official mrxsim SDK integration layer
    ├── auth_flow.py         # Orchestrates provisioning + browser + OTP submit
    └── tests/
        ├── conftest.py      # Session-wide preflight lock + fixtures
        └── test_auth_flow.py

Authentication Flow

flowchart LR

A[Pytest Session]

A --> B[Preflight Validation]

B --> C[Playwright Browser]

C --> D[Open Staging Login]

D --> E[Request Virtual Number]

E --> F[MRXSIM Platform]

F --> G[Receive Phone Number]

G --> H[Submit Phone]

H --> I[Poll for SMS]

I --> J[Retrieve OTP]

J --> K[Submit OTP]

K --> L[Validate Success State]
Loading

Features

  • Official MRXSIM QA toolkit
  • Real SMS OTP validation
  • Playwright browser automation
  • Async test execution
  • End-to-end authentication verification
  • Production-ready test architecture
  • Configurable UI selectors
  • Automatic preflight validation
  • CI/CD friendly
  • Official MRXSIM SDK integration

Requirements

Before executing the test suite, the following prerequisites must be satisfied:

  • Python 3.10+
  • Playwright with Chromium installed
  • Active MRXSIM account
  • Valid MRXSIM API Key
  • Available account balance funded through the MRXSIM dashboard (USDT/Crypto)

The suite cannot provision verification numbers or retrieve OTP messages without a valid, funded MRXSIM account.


Account Setup

Step Action
1 Create an MRXSIM account
2 Generate an API Key from the dashboard
3 Fund the account using the supported cryptocurrency deposit methods (USDT/Crypto)
4 Export MRXSIM_API_KEY before executing the test suite

Installation

Clone the repository:

git clone <this-repo>
cd playwright-sms-auth-tester
python3 -m venv venv && source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
playwright install chromium

Install the core dependency:

pip install mrxsim

Configuration

All runtime configuration is environment-driven, allowing the framework to target your own staging environment without code changes.

Variable Default Description
MRXSIM_API_KEY Required (or use MRXSIM_CONFIG_PATH)
MRXSIM_CONFIG_PATH Optional path for Client.from_config()
MRXSIM_COUNTRY usa Country for number provisioning
MRXSIM_SERVICE generic Service for number provisioning
STAGING_BASE_URL http://localhost:3000 Target staging login page
QA_HEADLESS true Run Playwright headless
SELECTOR_PHONE_INPUT input[name='phone'] Phone input selector
SELECTOR_PHONE_SUBMIT button[type='submit'] Phone submission button
SELECTOR_OTP_INPUT input[name='otp'] OTP input selector
SELECTOR_OTP_SUBMIT button[data-testid='otp-submit'] OTP submission button
SELECTOR_SUCCESS_INDICATOR [data-testid='auth-success'] Successful authentication selector
SELECTOR_ERROR_INDICATOR [data-testid='auth-error'] Authentication failure selector
OTP_TIMEOUT_SECONDS 120 Maximum OTP wait time
OTP_POLL_INTERVAL_SECONDS 3 SMS polling interval
OTP_RETRY_ATTEMPTS 1 OTP submission retries
NAVIGATION_TIMEOUT_MS 30000 Browser navigation timeout
ACTION_TIMEOUT_MS 10000 Playwright action timeout

Mandatory Preflight Validation

A session-scoped autouse=True fixture executes before any test begins.

The validation sequence verifies:

  1. MRXSIM_API_KEY or MRXSIM_CONFIG_PATH is present.
  2. Authentication against the MRXSIM platform succeeds.
  3. Account access is valid.
  4. Available account balance is confirmed.

If any validation step fails, the entire pytest session terminates immediately.

No browser automation or OTP provisioning begins until authentication has been successfully verified.


Usage

export MRXSIM_API_KEY="your-key-here"
export STAGING_BASE_URL="https://staging.myapp.internal/login"
export SELECTOR_PHONE_INPUT="input[name='phone']"
export SELECTOR_OTP_INPUT="input[name='otp']"
export SELECTOR_SUCCESS_INDICATOR="[data-testid='auth-success']"

python main.py -v
# or directly:
pytest qa_auth_tester/tests/test_auth_flow.py -v

Included Test Cases

Test Purpose
test_successful_otp_login Validates the complete authentication flow from provisioning through successful login
test_otp_delivery_latency_within_sla Measures SMS delivery latency against an expected SLA
test_blocking_wait_for_sms_path Validates blocking SMS retrieval behavior
test_ui_reaches_otp_input_stage Confirms the login flow successfully reaches the OTP entry stage

Test Workflow

flowchart TD

A[Start Test]

A --> B[Authenticate]

B --> C[Provision Number]

C --> D[Launch Browser]

D --> E[Submit Phone]

E --> F[Poll SMS]

F --> G[Receive OTP]

G --> H[Submit OTP]

H --> I[Validate UI]

I --> J[Test Pass]
Loading

SDK Integration

Virtual numbers and OTP messages are provisioned exclusively through the official MRXSIM Python SDK.

from mrxsim import Client

client = Client(country="usa", service="telegram")
order = client.get_number()
# ...
client.close()

Install the SDK:

pip install mrxsim

Authenticate:

export MRXSIM_API_KEY="your-mrxsim-api-key"

Security Model

All SMS provisioning and OTP retrieval requests are executed exclusively through the official MRXSIM Python SDK.

The toolkit does not communicate with third-party SMS providers or alternate provisioning services.

MRXSIM's privacy-oriented infrastructure is built around a zero-knowledge operational model, enabling organizations to automate authentication testing while minimizing unnecessary exposure of operational data.

Authentication is performed using dashboard-issued API keys, while account funding is handled through supported cryptocurrency deposit methods.


Production Integration

The toolkit is suitable for:

  • CI/CD Pipelines
  • GitHub Actions
  • GitLab CI
  • Jenkins
  • Azure DevOps
  • Internal QA Automation
  • Authentication Regression Testing
  • Browser Compatibility Testing
  • Continuous Validation of SMS Authentication Flows

Platform Requirements

This project requires:

  • Active MRXSIM account
  • Valid MRXSIM API Key
  • Funded account balance (USDT/Crypto)
  • Chromium installed through Playwright
  • Reachable staging environment
  • Network connectivity to MRXSIM APIs

Without these prerequisites, the test suite will terminate during preflight validation before executing any browser automation.


License

MIT

About

End-to-end Playwright & Pytest async testing framework for SMS OTP verification flows

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages