The test inbox
Use the email addresses Rehearsal makes, so a flow can read a code, a sign-in link or an invitation in the chat and on every run.
Many flows send an email somewhere in the middle, such as a sign-in code, a link to confirm an address or an invitation to a team. Rehearsal receives mail for your test accounts and for new users at addresses of its own, on inbox.rehearsal.dev, so Re:agent, the subagents of an exploration and your tests can all read it.
Addresses Link to Addresses
Rehearsal makes an address when an account needs one, from your workspace and the first 12 characters of the account's name, in lowercase letters, digits and hyphens. The account's row shows it, a passwordless account's form shows it before you add the account, and it stays the same from then on. No other account can ever have it, even after you remove this one.
| Who has one | Which address | Example |
|---|---|---|
| A Passwordless account | The same one every time, which the account signs in with. | parcel-member@inbox.rehearsal.dev |
| A Password account whose code is Sent by email | The same one every time, where Rehearsal reads the code after the password. | parcel-owner@inbox.rehearsal.dev |
| A new user, in a flow that signs up | A new one for every browser and every run, starting with fresh-. | fresh-55a96c3ffd89f41f2379c02b9bfed590036a9b08b973006c@inbox.rehearsal.dev |
Any other password account has no address here, because it signs in with the username or email you gave it. Test accounts and secrets explains the kinds.
If the environment you test sends mail only to some domains, add inbox.rehearsal.dev to them, or nothing reaches the test inbox.
How Re:agent reads it Link to How Re:agent reads it
When a flow makes your app send an email, Re:agent, or the subagent doing the work, reads the newest messages for that browser's address. Each read waits at most a minute for a message to arrive, and its row reads Read the test inbox with how many messages there were.
Rehearsal picks out the codes and the links of each message when it arrives. A code is 4 to 8 digits standing on their own in the subject or the text, with at most one space or hyphen inside, such as 482913 or 482 913. Rehearsal leaves out years, digits joined to letters and the digits inside a link. Links to your app come before links to anywhere else.
What is masked Link to What is masked
A code or a sign-in link is as good as a password, so Re:agent never sees the ones Rehearsal recognises. It reads each message with those codes written as {{code}} and its links numbered {{link:1}}, {{link:2}} and so on. Beside each number it sees the words the link was shown under and where it leads, with the query and any part of the path that looks like a token hidden, such as https://parcel.example/sign-in/[hidden]?[hidden].
Rehearsal counts a link as carrying a token when a name in its query or after its # reads like one, such as token, code, key or signature, when a part of its path follows a word such as verify, confirm, reset or invite, or when a part of its path is 32 characters or longer and mixes letters and digits. It keeps such a link hidden from Re:agent after it is opened too. Any other link counts as an ordinary address, and once opened it shows in full.
A code in another format, such as AB12CD, is not recognised. Re:agent sees it and types it as it is, so the saved flow holds that one code, and a test made from it fails as soon as your app sends a new one.
When Re:agent types {{code}}, Rehearsal types the real code, and when it opens {{link:1}}, Rehearsal opens the real link. {{link}} on its own means the first link that carries a token, or the first link when none does. The saved flow keeps these placeholders and never the values.
The chat keeps even less. What stays of the read in the conversation is one line with the number of messages and the newest subject, with the codes Rehearsal recognised taken out.
In the test Link to In the test
A code from last week does not sign anyone in today, so the test reads the inbox again on every run. Where the flow read the inbox, the test asks the person's inbox, here member, for the newest message:
const message = await test.step('Read the sign-in email', () => inbox('member').latest({ subject: 'sign-in code', timeout: 60_000 }));await test.step('Enter the code', async () => { await member.getByLabel('Code').fill(message.code); await member.getByRole('button', { name: 'Sign in' }).click();});latest() waits for a message that arrived after the test started, and subject picks one by a few words of its subject. On its own it waits 15 seconds, the time a check gets in a Rehearsal run, so the tests Rehearsal writes give it timeout: 60_000, a minute, because mail can take a while. message.code is its first code. For a link, the test opens message.link() for the first link that carries a token, message.link(2) for the second link, or message.link({ path: '/verify' }) for the first one under that path.
The test never holds a code or a link. Retest types the code and opens the link itself, and only on your app's own address, and its records write them as {{code}} and {{link}}. In a flow that signs up, the test types the run's new address with secret('email'), and when one person types another's address, such as member inviting a new teammate, it uses secret('teammate-email').
See the messages Link to See the messages
In Settings, Test accounts, an account with an address has a button to copy it and an arrow, Show the messages. It opens Last messages received, with when each message arrived, its subject, its sender and how many links it had.
A code shows only its last three digits, such as Code ending 913, and Show shows the whole code to someone with the Manage projects permission. The subject is shown as it arrived, though, so a code in the subject is readable there without Show, by anyone who can open the page. The addresses of new users from sign-up flows are not listed.
How long mail is kept Link to How long mail is kept
- Rehearsal keeps each message for seven days.
- A new user's address receives mail for 30 days after it was made.
- Mail marked as spam or as carrying a virus is dropped, and so are automatic replies, bounce reports and messages over 1 MB.
- An address takes at most 200 messages in 24 hours, and mail beyond that is dropped.
- When you remove an account, its address stops receiving mail.
Good to know
Each person in a flow reads their own inbox, so two people cannot share one address. A flow that reads mail for an account with no address cannot become a test, and the block in the chat says "This flow reads the test inbox, but its test account has no inbox to read."