Spring Boot teams often have stable controller tests and flaky end-to-end tests. Playwright can improve browser reliability, but the biggest production failures usually happen in the email step after form submission.

This guide shows a practical setup for Java/Kotlin teams that need both browser confidence and message verification.

Architecture at a glance

LayerToolingPurpose
App runtimeSpring Boot test contextStart real app flows on a random local port
Browser automationPlaywrightDrive forms, navigation, and UI assertions
Message verificationMailSlurp inbox APIWait for real email and assert token/link behavior
Release signalCI pipelineFail builds when user-critical messaging paths break

1) Start Spring Boot on a random test port

Use so each test process can run in parallel without fixed-port collisions.

This gives you a deterministic target URL per run: .

2) Add Playwright to your test dependencies

Gradle

Maven

3) Build a minimal reusable Playwright harness

4) Add email verification to the browser journey

Browser-only assertions miss common production failures:

  • email never arrives,
  • verification link has wrong tenant/environment host,
  • token is malformed or expired.

Pattern:

  1. Create a fresh inbox for this test.
  2. Submit signup form in Playwright with that address.
  3. Wait for verification email via API.
  4. Extract link or code.
  5. Continue browser flow and assert activated state.

5) Stabilize CI before scaling suite count

Use these controls before adding more scenarios:

  • one inbox per test (or per worker),
  • explicit API wait timeouts by flow type,
  • trace/screenshot on failure,
  • artifact capture for inbox ID + message ID + extracted token/link.

This keeps incident triage fast when failures happen.

Playwright vs MockMvc vs contract tests

  • : fastest for server-side behavior and validation logic.
  • : best for user-journey/browser-state confidence.
  • MailSlurp API assertions: best for message-delivery correctness and verification tokens.

Use all three where risk is highest.

Final take

For Spring Boot teams, Playwright is strongest when combined with real message verification. Treat email as part of the transaction boundary, not a side effect, and your release confidence improves materially.