Your tests keep their shape
The cost of changing email testing tool is not the subscription: it is the day spent rewriting assertions that worked. Here, only the lines that talk to the old service change. Your test still waits for a message, and still asserts something about its content.
What the migration asks
-
A few lines per file: the client, and the call that waits for the message.
-
Nothing to export: test messages come back on the next run of the suite.
-
Both tools in parallel while you compare, with nothing cancelled.
The same test, with one then the other
The example starts from Mailosaur. From Mailtrap, MailSlurp, Mailisk or Mailpit, the shape is the same: each tool's page gives the mapping.
// The Mailosaur client, and the code looked up in the body.
const MailosaurClient = require('mailosaur');
const mailosaur = new MailosaurClient(process.env.MAILOSAUR_API_KEY);
// Waits for the first matching message, 10 seconds by default.
const message = await mailosaur.messages.get(serverId, {
sentTo: address,
});
const code = message.html.codes[0].value;
import { Facteur } from '@facteur-eu/sdk';
const facteur = new Facteur(); // reads FACTEUR_API_KEY
// Searches every second and returns the message as soon as it arrives, 30 seconds at most.
const message = await facteur.messages.waitFor({
inbox: 'j3k9x2mq',
sentTo: address,
timeout: 30_000,
});
const { messages } = await response.json();
// The code is already extracted, in a field of its own.
const code = messages[0].otp;
Two ways to migrate: over HTTP, or with the library
The library adds comfort, not capabilities: everything it does, an HTTP call does too.
-
The direct call: a GET request on /messages, sent again every second until the message arrives, with since to keep older messages out.
-
The @facteur-eu/sdk library installs with npm i -D @facteur-eu/sdk. Its waitFor call searches every second and returns the message with its code and its links.
-
Versions 1.0.0 under this name target an old Facteur API: install 2.0.0 or later.
Five steps, none irreversible
-
Step 01
Create an account and an inbox
An inbox is a mailbox that receives, which your tests query by its id. The free plan is enough to validate the migration, and asks for no credit card.
-
Step 02
Put the API key in your environment
As FACTEUR_API_KEY, next to your current tool's key. Both live together: nothing asks you to remove the old one before you are convinced.
-
Step 03
Move a single test
The one that costs you most when it is flaky. A few lines to change, then run it: if it passes, your suite will.
-
Step 04
Run both suites in parallel
A week, long enough to compare pass rates on your own tests rather than on a sales page. That is also what makes going back free.
-
Step 05
Set your caps and your alerts
On paid plans, a message cap per inbox, and thresholds that warn by email before it is reached: a test stuck in a loop stops on its own limit instead of using up the whole team's volume.
What is specific to the tool you leave
Each page sets out what the tool publishes, sourced and dated, and the mapping of its calls.
Mailisk
A call that waits for the message on both sides: the address changes, and the code arrives extracted.
Mailtrap
From a sandbox that intercepts to an inbox that receives.
MailSlurp
What becomes of an inbox created then deleted in every test.
Mailpit
Leaving a local service: what you take out of the pipeline.
Mailosaur
The mapping of the API calls, one by one, and the ones with no equivalent.
What your tool may do, and Facteur does not yet
Written here rather than found in the middle of a migration. If your suite depends on one of these points, write to us: we will tell you whether the migration makes sense today, or not.
-
Downloading the raw message as an .eml file does not exist in the public API.
-
Deliverability analysis (SPF, DKIM, DMARC, spam score) does not exist.
-
Rendering previews across mail clients and the visual template editor have no equivalent, and will not: it is not the same product.
Frequently asked questions
How many lines change, really?
The ones that talk to the old service: building the client and the call that waits for the message. The assertion often gets shorter, because the one-time code arrives already extracted in a field of the message. What does not change is the structure of the test.
Do I have to switch everything at once?
No, and that is the only advice of this page. Move one test, keep both tools for a week, compare on your own suites. Nothing in the migration is irreversible until you cancel the other subscription, and that decision stays yours.
What happens to the messages already received at the other service?
They stay there, and that is what keeps the migration light: they are test messages, they come back on the next run of your suite. There is nothing to export and no DNS switch to plan.
What if my tool is not among the five?
The steps on this page do not depend on the tool you leave: a client, a call that waits, an assertion. Write us the name of the tool and we will tell you what carries over, before you open an account.
Move one test, not a suite
The free plan asks for no credit card. One file, a few lines, and you will know.