Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Test Email Verification Flows with Playwright

Your Playwright Test Sent an Email. Now What? You've automated the signup form. await page . goto ( ' /signup ' ); await page . getByLabel ( ' Email ' ). fill ( ' test@example.com ' ); await page . getByRole ( ' button ' , { name : ' Sign up ' }). click (); Your application responds with: ๐Ÿ“ฉ We sent you a verification email. And now your E2E test has a problem. How does Playwright get that email?โ€ฆ

Testing email verification flows with Playwright can be challenging. While Gmail can be used for manual testing, it introduces complexities when automating the process. CI runners require access to inboxes, parallel tests may cause issues, and Gmail credentials are needed for configuration.

To address these issues, a more programmatic approach is recommended. Utilize a test inbox service like mailQA to create unique test email addresses. This approach allows the application to send verification emails as usual, just like with a real mailbox.

Once an email is received, it needs to be retrieved programmatically. The test awaits the email using mailQA's waitForEmail method, specifying the unique test email address. After retrieving the email, assertions can be made on its subject, recipient, and HTML content to ensure the email was sent correctly.

The next step is to extract the verification link from the email's HTML content. This URL can be obtained using an extractVerificationLink function. With the verification link in hand, Playwright can navigate to it and verify that the account has been successfully verified.

The entire flow can now be automated and run unattended in CI/CD pipelines. This method eliminates the need for manual inbox access, parallel test conflicts, and Gmail configuration, making the testing process more reliable and efficient.

Written by urgent.news from Dev.to's reporting โ€” not their text. Machine-written โ€” may contain errors; check the original before relying on it.

Read the original at dev.to โ†’

More in Tech

The First Bugs My Reconciliation Tool Caught Were Its Own

I wrote a small open-source tool, onchain-tieout, to answer one question: does the balance you reconstruct from a wallet's transaction history match the balance the chain actually reports, at the sameโ€ฆ

  • First bugs discovered were in the tool itself, not external bugs
  • Page size specification error caused premature stopping of balance reconstruction
  • Tool misinterpreted HTTP 429 responses as data issues

IMF Satisfied With Pakistan

The International Monetary Fund (IMF) mission has expressed satisfaction with a briefing from State Bank of Pakistan (SBP) officials as โ€ฆ Read More The post IMF Satisfied With Pakistan appeared firstโ€ฆ

Sending SMS to Israel: number formats, Hebrew encoding and sender IDs

If your app sends SMS worldwide, Israel has a few quirks that silently break validation, inflate costs or annoy users. This is a short checklist. The full guide is linked at the end. 1.

  • Israeli mobile numbers start with 05 and use +972 for international formats
  • Hebrew characters count as two GSM-7 characters, limiting SMS length
  • Marketing messages require prior consent and easy opt-out in Israel

More from Sunday 27 September โ†’