---
title: "Automated End-to-End SMS Verification Testing with Playwright and Webhooks"
---

Automated End-to-End SMS Verification Testing with Playwright and Webhooks: SMSRiver

- [Skip to main content](#main-content) [sms river .com](/) [Public Inboxes](/#numbers-section) [Country Codes](/country-codes/) [Workbench](/workbench/) [Tools](/tools/) [Developer API](/developer/) [Pricing](/pricing/) [Log In](/accounts/login/) [Log In](/accounts/login/) [Get API Key](/pricing/) [Home](/)

- [Articles](/articles/)

- QA Automation & Testing

QA Automation & Testing

Published 2026-08-13

•

9 min read

# Automated End-to-End SMS Verification Testing with Playwright and Webhooks

Step-by-step tutorial: automate 2FA user onboarding and OTP verification in Playwright using SMSRiver's REST API and synthetic test numbers.

Key Takeaway & Executive Summary

Automate complete browser signup and 2FA authentication in Playwright test suites without physical handsets or manual OTP copy-paste.

End-to-end testing of user registration pipelines is notoriously difficult when the application mandates SMS verification. Testing teams frequently disable 2FA in staging or use brittle manual workarounds. This guide shows how to automate real SMS verification in Playwright suites.

## Table of Contents

- [The Playwright Automation Architecture](#section-1)

- [Playwright TypeScript Implementation](#section-2)

- [Frequently Asked Questions](#frequently-asked-questions)

## 1 The Playwright Automation Architecture

The test workflow operates in 4 automated steps:

1. Playwright opens the signup page, fills in credentials, and enters a provisioned test phone number.
2. Application sends OTP via SMS API.
3. Playwright polls SMSRiver's REST API (GET /api/v1/inbox/{phone}/messages/) or waits for webhook callback.
4. Playwright extracts the 6-digit regex token from the message body and inputs it into the browser verification form.

## 2 Playwright TypeScript Implementation

typescriptimport { test, expect } from '@playwright/test';

test('User completes SMS verification onboarding', async ({ page }) => {
const testPhone = '+12025550199';
await page.goto('/signup');
await page.fill('#phone-input', testPhone);
await page.click('#submit-btn');

// Poll SMSRiver API for latest received OTP
const otpResponse = await fetch(`https://smsriver.com/api/v1/inbox/12025550199/messages/`, {
headers: { 'Authorization': `Bearer ${process.env.SMSRIVER_API_KEY}` }
});
const data = await otpResponse.json();
const otpCode = data.messages[0].body.match(/\b\d{6}\b/)[0];

await page.fill('#otp-input', otpCode);
await page.click('#verify-btn');
await expect(page.locator('#dashboard')).toBeVisible();
});

## Frequently Asked Questions • QA Automation & Testing

Can this test run concurrently in CI/CD parallel jobs?

Yes. Each parallel test worker can query a distinct test number from your SMSRiver private pool or inject synthetic SMS events dynamically.

## Related Technical Articles & Deep Dives

[QA Automation & Testing
8 min read

Integrating Synthetic SMS Test Events into GitHub Actions CI/CD Pipelines](/articles/ci-cd-synthetic-sms-pipeline-testing/)

[QA Automation & Testing
7 min read

Mocking Inbound Carrier Webhooks in Local Development Environments](/articles/mocking-carrier-webhooks-in-local-dev/)

[QA Automation & Testing
7 min read

Cypress E2E Testing of Inbound SMS Verification Codes Without Real SIMs](/articles/cypress-sms-verification-workflow-testing/)

Developer Sandbox

### Automate Inbound SMS & OTP Testing

Eliminate flaky 2FA in CI/CD. Access dedicated virtual lines, programmable synthetic SMS webhooks, and Model Context Protocol (MCP) integrations.

[Explore Developer Tiers →](/pricing/)
[View MCP Setup Guide](/developer/mcp-setup/)

### Developer Utilities

- [SMS Segment Calculator Calculate segment counts and carrier costs in real time.](/tools/sms-segment-calculator/)

- [Webhook Payload Validator Verify JSON webhook payloads against provider schemas.](/tools/webhook-payload-validator/)

- [SMS Delivery Troubleshooter Diagnose carrier filtering and OTP delivery failure.](/tools/sms-delivery-troubleshooter/)

- [E.164 Phone Number Formatter Format phone numbers into international E.164 standard.](/tools/phone-number-formatter/)

### Public Verification Numbers

- [United States (+1) View Line →](/receive-sms/us/)

- [United Kingdom (+44) View Line →](/receive-sms/gb/)

- [Canada (+1) View Line →](/receive-sms/ca/)

- [Germany (+49) View Line →](/receive-sms/de/)

Copied to clipboard

FULL PACKET INSPECTION
SMS

### Line: DE +49 ...

Timestamp: Just now

Extracted code

Copy Code

Message Body:

Copy Full Message

[Open Live Inbox](#)

smsriver.com

Central Office carrier inventory platform & developer SMS verification sandbox. Receive OTP codes instantly with zero SIM card requirement.

Public numbers·Live inboxes·Developer tools

Public Inboxes

- [United States (+1)](/receive-sms/us/)

- [United Kingdom (+44)](/receive-sms/gb/)

- [Canada (+1)](/receive-sms/ca/)

- [Philippines (+63)](/receive-sms/ph/)

- [Germany (+49)](/receive-sms/de/)

Developer & Tools

- [SMS Debugging Workbench](/workbench/)

- [Phone Number Inspector](/tools/phone-number-inspector/)

- [Bulk Phone Validator](/tools/bulk-phone-validator/)

- [Phone Lookup API](/developer/phone-lookup-api/)

- [E.164 Phone Formatter](/tools/phone-number-formatter/)

- [SMS Segment Calculator](/tools/sms-segment-calculator/)

- [Webhook Validator](/tools/webhook-payload-validator/)

Guides & Trust

- [Country Calling Codes](/country-codes/)

- [Troubleshooting Hub](/troubleshooting/)

- [Carrier Comparisons](/compare/)

- [Developer Reference](/developer/)

- [OpenAPI Specification](/openapi.json)

- [MCP Tools Manifest](/.well-known/mcp.json)

- [Privacy & Security Guides](/guides/)

- [Engineering Articles](/articles/)

© 2026 SMSRiver. Operating on Cloudflare Workers & D1. Adheres to CTIA Messaging Principles and 10DLC compliance standards.

[About](/about/)
[Contact](/contact/)
[Privacy Policy](/privacy/)
[Terms of Service](/guides/terms-of-service/)
Cookie Preferences