Mailisk for Cypress
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
Trigger a workflow, then use the Mailisk Cypress commands to grab the email or SMS payload inside the same spec.
describe("Signup verification", () => {
const namespace = "checkout-tests";
const userEmail = `user@${namespace}.mailisk.net`;
it("confirms the verification email", () => {
cy.visit("/signup");
cy.get("#email").type(userEmail);
cy.contains("button", "Create account").click();
cy.mailiskSearchInbox(namespace, {
to_addr_prefix: userEmail,
subject_includes: "Verify your account",
}).then(({ data }) => {
expect(data).to.not.be.empty;
const email = data[0];
const match = email.text.match(/https?:\/\/\S+/);
expect(match).to.not.be.null;
const link = match[0];
cy.visit(link);
});
});
});describe("MFA flow", () => {
const phoneNumber = "+15551234567";
it("reads the OTP from Mailisk", () => {
cy.visit("/login");
cy.contains("Use SMS").click();
cy.get("#phone").type(phoneNumber);
cy.contains("Send code").click();
cy.mailiskSearchSms(phoneNumber, {
body: "Your login code",
}).then(({ data }) => {
expect(data).to.not.be.empty;
const sms = data[0];
const otp = sms.body.match(/(\d{6})/)[1];
cy.get("#otp").type(otp);
cy.contains("Verify").click();
});
});
});Avoid brittle mocks. Hit the same verification emails your customers receive and assert their content with real data.
Step 1
Add the mailisk-cypress package, load it in cypress.config, and expose your API key through CYPRESS_MAILISK_API_KEY.
Step 2
Create a new namespace in the dashboard for use in tests.
Step 3
Call cy.mailiskSearchInbox or cy.mailiskSearchSms from within your tests and assert HTML, text, or links.
Use cy.mailiskSearchInbox() & cy.mailiskSearchSms() with the same chainable syntax you expect.
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 Cypress CI