Automation lab Aú E2E Workflows (E2E_WORKFLOWS)

Lab 108: Expert: Idempotent checkout under network retry (no duplicate order)

Simulate network retries during checkout and ensure idempotent order creation.

expert expert
expert

Objectives

Use for test scripts
  • Design idempotent checkout flows under retry conditions.
  • Validate duplicate order prevention within the retry window.
  • Assert stock changes only once per checkout.
  • Capture request observability signals for deduplication.

Sandbox

E2E Workflows | e2e-workflows | expert | active

Expert: Idempotent checkout under network retry (no duplicate order)

Simulate flaky checkout retries and verify idempotency keys, dedup hits, and stock changes.

Idempotency Network retry Observability

Learning objectives

  • Design idempotent checkout flows under retry conditions.
  • Validate duplicate order prevention within the retry window.
  • Assert stock changes only once per checkout.
  • Capture request signals for deduplication.

Steps

  1. Login as buyer USER_08 and add product P010 to cart.
  2. Enter or generate an idempotency key.
  3. Place the order and simulate a timeout response.
  4. Retry the request and verify the same orderId is returned.
  5. Confirm history has a single order and stock decrements once.

Expected results

  • Exactly one order is created for the checkout attempt.
  • Repeated requests with the same key return the same orderId.
  • Order history shows only one order within the retry window.
  • Stock is decremented only once.
  • Request log records timeout, retry, and dedup events.

Practice sandbox

Checkout with idempotency keys and retry simulation.

Live

Active user

Not signed in.

Guest

Checkout

Product P010 stock: 20

0 items

Last response: -

Simulation controls

Retry window: 60s

Time offset: 0s

Signals to observe

  • requestId logged per attempt.
  • Idempotency key stored with order.
  • Dedup hit returns the same orderId.

Order history

0 orders
Order Key Status Actions

Select an order to view details.

Request log

0 attempts
    Ready.

    Assertions to practice

    • Timeout attempt does not create duplicate orders.
    • Retry with the same key returns the same orderId.
    • Stock decreases once across retries.