Playwright is one of today's leading end-to-end testing frameworks and a favourite of modern QA teams. Yet sign-up and authentication scenarios often hit a wall when email or SMS verification is involved. That's where the playwright-mailslurp plugin comes in.
MailSlurp's Playwright integration lets you spin up real email inboxes and phone numbers on-demand during every test run. With those live accounts you can send and receive messages inside your spec files, covering flows such as account-verification, two-factor authentication, password resets, and far more.
Real users, real tests
Many teams still resort to clicking through sign-up or login flows manually because talking to SMTP servers or Gmail APIs is brittle. MailSlurp creates unique, disposable user identities instantly so each Playwright test runs in perfect isolation with genuine credentials.
Throwaway mailboxes in Playwright tests
Before each test run use MailSlurp to generate disposable user accounts and then fill sign-up forms using the new email addresses.
Create global phone numbers
Attach real mobile phone numbers from Telecom providers around the world. Use them to send and receive SMS and text messages during Playwright testing. This is invaluable to QA teams that need to test 2FA or one-time passwords via cell.
Unique test functions
Leverage MailSlurp's powerful testing functions designed especially for quality assurance. These include code extract functions, link fetching methods, and utilities to wait for expected content to arrive by SMS or email.
Wait for matching
MailSlurp's wait functions let you wait for specific emails to arrive in inboxes. This solves the problem of flaky tests and ensures that Playwright tests are reliable and run in parallel without conflicts.
Find and click links
Find matching href links and anchors in emails then click them in playwright:
Extract codes
Use regex patterns to capture and parse email content and extract matching codes. Perfect for testing 2FA and one-time passwords, as well as email confirmation links.
XPATH HTML queries
Use HTML selectors to extract HTML email content just like in Playwright selectors:
Cross-platform support
MailSlurp has official plugins for a range of languages so you can use email and phone numbers in whatever language you write your Playwright tests with: