慣性聚合 高效追讀感興趣之博客、新聞、科技資訊
閱原文 以慣性聚合開啟

推薦訂閱源

美团技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
V
V2EX
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
博客园 - 【当耐特】
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Testing OTP email flows shouldn't be flaky — meet AssertKit
Jeffrey Marv · 2026-05-24 · via DEV Community

Jeffrey Marvin Forones

The single most flake-prone test in any E2E suite is "user signs up,
verifies via emailed OTP, completes onboarding." Why? Because the email
is async, the test runner can't see it, and the bridge between the two
is a 60-line polling helper everyone writes once and nobody wants to
maintain.

I shipped AssertKit to remove that bridge entirely.

The pitch in 8 lines of test code:

  import { test } from "@assertkit/playwright";

  test("signup with OTP", async ({ page, inbox }) => {
    await page.goto("/signup");
    await page.getByLabel("Email").fill(inbox.address);
    await page.getByRole("button", { name: "Sign up" }).click();
    const otp = await inbox.waitForOtp({ from: "noreply" });
    await page.getByLabel("Code").fill(otp);
  });

Enter fullscreen mode Exit fullscreen mode

That's it. No polling. No regex. No flake.

How it works

  1. The inbox fixture gives every test a unique disposable address (foo-1717xxx@assertkit.com).
  2. waitForOtp long-polls the AssertKit server for up to 25 seconds.
  3. The server watches for inbound mail to that address, extracts any OTP-shaped code, and returns it as a typed field.
  4. Your test gets a string, not an email body to parse.

Cypress users: same package, same shape:

  import "@assertkit/cypress";

  cy.uniqueInbox().then((inbox) => {
    cy.visit("/signup");
    cy.get('input[name="email"]').type(inbox.address);
    cy.get('button[type="submit"]').click();
    cy.waitForOtp(inbox.local).then((otp) => {
      cy.get('input[name="otp"]').type(otp);
    });
  });

Enter fullscreen mode Exit fullscreen mode

Try the live demo (no signup):
https://assertkit.com/demo

The demo opens a real long-poll against the real wait endpoint. A
canned email arrives 3 seconds later. You'll see the OTP land in real
time.

Free to try:

  • Both npm packages are MIT, zero runtime deps
  • The free public API works without an account
  • Subscriptions aren't open yet — there's a /beta program for early access with admin approval

Tech stack (if anyone's curious): Next.js 16 App Router, Drizzle +
Neon Postgres, Supabase Realtime for sub-100ms broadcast, CloudMailin
for inbound MX, Resend for outbound (DKIM-signed), Upstash KV for
rate limits, argon2id + RFC 6238 TOTP for auth.

Solo founder, happy to answer anything.