Playwright
Learn how to test SMS and email messages in Playwright, using SMSByrd.
What is Playwright?
Playwright is a Node.js library that lets you automate modern web browsers. Playwright is made by Microsoft and is used as part of the Quality Assurance testing of Microsoft’s own service.
At this stage, we assume that you already know how to test with Playwright, however if you’re just getting started, check out the official Playwright guide, then come back here to start testing SMS and email!
What is SMSByrd?
SMSByrd is a service that captures SMS and email messages and lets you test them, both via it’s web dashboard and via the SMSByrd testing API.
If you don’t already have one, create a free account trial now, and send an email into SMSByrd first. Once you have this working, you’re ready to start testing!
1. Get what you need from SMSByrd
To write SMSByrd tests, you will need a Project ID, Server Domain, and an API key to test with.
These attributes can all be accessed via the API tab within the SMSByrd Dashboard.
For more information: Learn more about Project IDs & Domains or API Keys.
2. Create a Playwright test that triggers an email
First, you will need a test that causes an email to be sent - for example an account verification or, in this example, a password reset:
//code snippet
3. Install the SMSByrd Node.js library
Because Playwright is JavaScript-based, you can easily couple it with the official SMSByrd Node.js library.
//code snippet
4. Use SMSByrd with Playwright
//code snippet
Email not found in time?
By default, the get method only looks for emails that were received by SMSByrd within the last hour.
You can override this by setting creceivedAfter, like so:
//code snippet
Library reference
Check out all of the methods available to the SMSByrd Node.js library.
Common test cases
Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality.
Check out these guides on the most common test cases: