DEV Community

Jon Perl
Jon Perl

Posted on

Test receiving an email in 2 minutes

QA Wolf provides a getInbox method that returns:

  • email: your team's email address
  • waitForMessage: function that waits for an email message to the test address

Let's use getInbox and waitForMessage in our test.

Below we 1) get an email address, 2) fill out the form, and 3) wait for a message and assert it's content.

const { context } = await launch();
const page = await context.newPage();
await page.goto("https://ismyemailworking.com");
// use our test email to fill out the form
const { email, waitForMessage } = getInbox();
await page.fill("#verify_email", email);
await page.click("#content_cob_check");
// wait for a message and check it starts with "Congratulations"
const message = await waitForMessage();
console.log(message);
assert(message.text.startsWith("Congratulations"));
Enter fullscreen mode Exit fullscreen mode

GitHub logo qawolf / qawolf

🐺 Create browser tests 10x faster

QA Wolf - Ship confidently

We take testing off your plate. We build complete coverage in 4 months and keep you there. You get unlimited, parallel test runs on our infrastructure, and we guarantee zero flakes. It’s like magic but it’s QA Wolf.

tweet

🐺 What is QA Wolf?

At QA Wolf, we’re building the magical QA experience that we wanted when we were managing engineering teams. With zero effort on your part, we get you to 80% automated test coverage in 4 months — and keep you there.

  • We plan. You’ll get a test matrix covering every user flow in your web app, from happy path to edge case and everything in between.
  • We automate. Using vanilla, open source Microsoft Playwright so that there’s no vendor lock-in — you own every test.
  • We run. Every test in full parallel, on our own infrastructure, as many times as you want —…

Top comments (0)