Mailisk for Playwright
From email notifications to SMS alerts, promotional offers to authentication flows
Mailisk lets you build end-to-end tests for your email and SMS workflows, effortlessly.
Integration example
Use the official SDK inside Playwright tests to await the exact email or SMS you expect after triggering a flow.
import { test, expect } from "@playwright/test";
import { MailiskClient } from "mailisk";
const namespace = "pw-ci";
const mailisk = new MailiskClient({ apiKey: process.env.MAILISK_API_KEY });
test("reads the reset email", async ({ page }) => {
const testEmail = `user@${namespace}.mailisk.net`;
await page.goto("/forgot-password");
await page.getByLabel("Work email").fill(testEmail);
await page.getByRole("button", { name: /send reset/i }).click();
const { data } = await mailisk.searchInbox(namespace, {
to_addr_prefix: testEmail,
subject_includes: "Reset password",
});
expect(data.length).toBeGreaterThan(0);
const email = data[0];
const m = email.text?.match(/https:\/\/example\.com\/\S+/);
const resetLink = m?.[0];
await page.goto(resetLink ?? "/");
});import { test, expect } from "@playwright/test";
import { MailiskClient } from "mailisk";
const mailisk = new MailiskClient({ apiKey: process.env.MAILISK_API_KEY });
test("captures the MFA SMS", async ({ page }) => {
const phoneNumber = "+15550001111";
await page.goto("/login");
await page.getByRole("button", { name: /use sms/i }).click();
await page.getByLabel("Phone number").fill(phoneNumber);
await page.getByRole("button", { name: /send code/i }).click();
const { data } = await mailisk.searchSmsMessages(phoneNumber, {
body: "Your login code",
});
expect(data.length).toBeGreaterThan(0);
const otp = data[0]?.body?.match(/(\d{6})/)?.[0];
await page.getByLabel("One-time code").fill(otp ?? "");
await page.getByRole("button", { name: /verify/i }).click();
});Avoid brittle mocks. Hit the same verification emails your customers receive and assert their content with real data.
Step 1
npm install mailisk and store your API key as MAILISK_API_KEY inside the Playwright config.
Step 2
Create a new namespace in the dashboard for use in tests.
Step 3
Call mailisk.searchInbox or mailisk.searchSms from within your tests and assert HTML, text, or links.
MailiskClient ships with typed responses that plug directly into Playwright test code.
The library has been designed to be easy to use and understand.
Debug payloads directly from the dashboard or API client. Inspect headers, attachments, or OTP payloads instantly.
Easily automate attachment testing. Every email response includes attachment metadata.
Capture inbound SMS to validate MFA and passwordless logins alongside your email checks.
Every message lives on GDPR-compliant infrastructure with configurable retention windows.
Generate OTP codes, parse verification links, and assert locale-specific templates from within Cypress.
Cover receipts, shipping updates, and billing alerts by checking headers, attachments, and SMS mirror messages.
Assert that payment confirmations display correct amounts and metadata by parsing structured payloads.
Preview emails directly in the dashboard without sending them to yourself. Debug issues easily, see metadata and attachments.
Bring Mailisk to your Playwright CI