Forms E2E Testing Protocol

Forms E2E Testing Protocol

Purpose

This protocol defines the mandatory end-to-end validation steps for all contact forms, waitlist submissions, and user-facing form handlers. HTTP 200 response is NOT sufficient evidence of success — inbox delivery or database persistence MUST be verified.

Scope

Applies to:

Test Levels

Level 1 — HTTP Layer (Necessary but NOT Sufficient)

  1. Submit form via browser (real user flow)
  2. Verify HTTP response: 200 OK or 201 Created
  3. Verify UI feedback: success message displayed
  4. ⚠️ STOP: This is NOT proof the form works. Proceed to Level 2.

Level 2 — Delivery Verification (MANDATORY)

For Email-Based Forms

  1. Submit test form with known test data (e.g., test@example.com, subject: "E2E Test YYYY-MM-DD HH:MM")
  2. Check target inbox within 60 seconds:
    • Via Himalaya CLI: himalaya search --account info@alai.no --folder INBOX "subject:E2E Test"
    • Via webmail: Log into one.com or Gmail, verify message received
    • Via IMAP client: Thunderbird, Apple Mail, etc.
  3. Verify message contents:
    • All form fields present in email body
    • From address is correct (e.g., noreply@alai.no or form submitter)
    • Reply-to is user's submitted email (if applicable)
  4. Verify SMTP logs (if accessible):
    • Check Resend dashboard (for Resend API)
    • Check Cloudflare Email Workers logs
    • Check backend logs (journalctl -u form-handler or PM2 logs)

For Database-Based Forms (e.g., waitlist with D1)

  1. Submit test form with unique identifier (e.g., email test+TIMESTAMP@alai.no)
  2. Query database:
    • CF D1: wrangler d1 execute drop-waitlist --command "SELECT * FROM submissions WHERE email LIKE 'test+%'"
    • PostgreSQL: psql -h localhost -U user -d dbname -c "SELECT * FROM waitlist WHERE email = 'test@example.com';"
    • SQLite: sqlite3 ~/path/to/db.sqlite "SELECT * FROM forms WHERE email = 'test@example.com';"
  3. Verify record fields:
    • Timestamp is recent (within last 2 minutes)
    • All form fields stored correctly
    • No NULL values where data expected

Level 3 — Error Handling (Recommended for Production Forms)

  1. Submit invalid data:
    • Missing required fields
    • Invalid email format
    • XSS/SQL injection attempts (if validation implemented)
  2. Verify error responses:
    • HTTP 400 Bad Request (not 500 Internal Server Error)
    • Clear error message to user ("Email is required")
    • No server crash or 500 error
  3. Simulate backend failure:
    • Temporarily break SMTP credentials or DB connection
    • Verify graceful failure (user sees "Failed to send, please try again" — not silent success)
    • Verify logging of failure (so ops team can detect issue)

Himalaya CLI Setup (for Email Verification)

Install

brew install himalaya

Configure Account

Add to ~/.config/himalaya/config.toml:

[accounts.info-alai]
default = false
email = "info@alai.no"
display-name = "ALAI Info"

[accounts.info-alai.imap]
host = "imap.one.com"
port = 993
encryption = "tls"
login = "info@alai.no"
passwd.cmd = "bw get password 'Email - info@alai.no' --session $(cat /tmp/bw-session)"

[accounts.info-alai.smtp]
host = "send.one.com"
port = 587
encryption = "start-tls"
login = "info@alai.no"
passwd.cmd = "bw get password 'Email - info@alai.no' --session $(cat /tmp/bw-session)"

Usage

# List recent messages
himalaya list --account info-alai --folder INBOX --page-size 20

# Search for test submissions
himalaya search --account info-alai --folder INBOX "subject:E2E Test"

# Search by sender
himalaya search --account info-alai --folder INBOX "from:noreply@alai.no"

# Search by date
himalaya search --account info-alai --folder INBOX "since:2026-04-21"

Credentials: Store IMAP password in Bitwarden item "Email - info@alai.no"

Pre-Deployment Checklist

Before marking any form handler as "ready for production":

Migration Checklist (Static Hosting Migrations)

When migrating sites from Vercel/Netlify to Cloudflare Pages:

Known Silent Failure Patterns

Pattern 1: Catch-All Webhook Returns False Success

Pattern 2: Serverless Function Not Migrated

Pattern 3: SMTP Credentials Not Migrated

MC Task References


Authored: 2026-04-21 | Owner: Skillforge (QA protocol) + Proveo (enforcement) | Approved: Angie Jones


Revision #2
Created 2026-04-21 11:40:58 UTC by John
Updated 2026-05-31 20:06:23 UTC by John