Prerequisite: A Momentic-provisioned inbox (@usemomentic.com or
@gomomentic.com). Request one.
Your app emails a one-time passcode to the provisioned inbox, and a
JavaScript step in the test fetches the latest message and pulls the code
out. Use this recipe when login arrives as a code instead of a link.
Fetch the code
Add a JavaScript step that reads the latest email, parses the code, and
saves it to the environment.
Then add a Type step with value {{ env.OTP_CODE }} targeting the OTP
input.
Always pass afterDate to avoid matching a stale code from a previous run.
This script polls for up to 30 seconds, well within the JavaScript step’s
90-second default timeout. For longer polls, raise the step’s Timeout
field (cloud runs cap the timeout at 60s; the CLI supports up to 10 minutes).