Expected Non-2xx Responses
Issue: A step expects a non-2xx response (like a 401, 403, or 404), the API returns it, but the check still fails Playwright’srequest fixture does not throw an error on non-2xx status codes. A 403 response is a completed request. If the check fails, an assertion in your test is failing.
The most common cause is expect(response).toBeOK(). This assertion only passes for status codes in the 200-299 range, so it fails on an expected 403.
Solution: Assert the exact status code you expect instead of using toBeOK():
Authentication and Authorization
Issue: Authentication failures or token expiration Solutions:- Verify credentials are current and valid
- Implement token refresh logic for long workflows
- Check API permissions for all required endpoints
- Use environment variables for sensitive credentials
Data Flow Problems
Issue: Variables not passing correctly between steps Solutions:- Verify variable assignment syntax and scope
- Add logging to track variable values
- Check JSON parsing and data extraction logic
- Validate API response formats match expectations
Timing and Performance Issues
Issue: Workflows timing out or running slowly Solutions:- Optimize API performance and database queries
- Increase timeout values for complex operations
- Implement parallel processing where possible
- Add monitoring for long-running operations
Error Handling and Recovery
Issue: Workflows failing without proper cleanup Solutions:- Implement try-catch blocks with proper error handling
- Add cleanup logic in finally blocks
- Design idempotent operations for safe retries
- Create rollback procedures for failed transactions