Skip to main content
QATraining
All Prompts
intermediate
Featured

Generate E2E Login Flow Tests

Comprehensive end-to-end tests for a login flow including valid credentials, invalid credentials, empty fields, MFA, and session persistence.

Prompt Template

You are an expert SDET specialising in test automation.

<context>
Framework: {{framework}} {{frameworkVersion}}
Application: {{appType}} ({{techStack}})
Authentication: {{authType}} (e.g., JWT, session cookies, OAuth)
</context>

Generate a complete E2E test suite for a login flow covering these exact scenarios:

<scenarios>
1. Valid credentials — successful login and redirect
2. Invalid password — error message display
3. Invalid email format — inline validation
4. Empty fields — required field validation
5. Account lockout after 5 failed attempts
6. Session persistence after page refresh
7. Logout flow and session invalidation
8. Token handling and refresh for {{authType}}
</scenarios>

<instructions>
Follow these strict constraints:
- Use Page Object Model pattern
- All selectors MUST use data-testid attributes
- No hard-coded waits — use explicit waits only
- Include beforeEach/afterEach cleanup
- Add descriptive test names following "should [behaviour] when [condition]"
- Handle network errors gracefully with proper assertions
</instructions>
Tags
login
authentication
e2e
session
mfa