Performance ModifySimulate Latency• 4 min read
How to Simulate Network Latency and API Delays
Summary: Inject artificial delays (e.g. 1500ms, 3000ms) on individual API endpoints to test asynchronous race conditions and loading UI states.
Why This Rule Matters for Developers & QA
Fast local networks often hide critical UI bugs like missing spinners, flickering skeletons, or unhandled promise race conditions. Adding millisecond delay rules tests real-world mobile scenarios.
Step-by-Step Implementation Guide
1
Choose Endpoint to Throttle
Target the API request where you want to test loading states (e.g. `*/api/search*`).
2
Set Latency in Milliseconds
Specify the exact delay duration (e.g. `2500` for a 2.5 second delay).
3
Observe UI Loading State
Trigger the action in your app and confirm that loading indicators, shimmer effects, and abort controllers behave as intended.
Configuration Snippet
{
"id": "rule_simulate_search_delay",
"pattern": "*/api/search*",
"action": "delay",
"delayMs": 2500,
"enabled": true
}