Start from Logged-in State
Starting from a Logged-in State
When you need to run a test that requires an authenticated user:
1
Enable the option
Check “Start from logged-in state”
2
Select login test
Select a login test from the dropdown
3
Run your test
Your test will begin with the authentication state from the selected test
This is particularly useful for:
- Tests that require an authenticated user
- Avoiding redundant login steps
- Maintaining consistent test states
Save Login State
Saving Login State Configuration
Enable this option when:
- Your test performs a login that other tests might need
- You want to make the authentication state reusable
- You’re creating a dedicated login test
Login states are saved at the end of test execution and can be used by other tests that select this test as their login state source.
Parallel Test Execution with Multiple Accounts
- Example Setup
- Benefits
Best Practices
Create Dedicated Login Tests
- Separate tests for different user roles
- Keep login tests focused and minimal
- Clear naming conventions (e.g., “Admin Login”, “Customer Login”)
State Management
- Save login states from authentication tests
- Reuse login states to reduce execution time
- Consider test dependencies when managing states
Security Considerations
- Use environment variables for credentials
- Regularly update saved login states
- Clear authentication data in teardown tests
Common Scenarios
Multiple User Roles
Multiple User Roles
When testing features that require different user roles:
E-commerce Flow
E-commerce Flow
For an e-commerce website:
Auth Modules
Auth modules are pre-built authentication sequences that handle common login patterns:- Password Authentication
- Multi-factor (MFA)
1
Accept credentials
Accept email and password as inputs
2
Navigate
Navigate to your login page
3
Fill form
Fill in credentials
4
Submit
Submit the form
5
Verify
Verify successful authentication
6
Save
Save session data if needed
Role-based Modules
Admin Authentication
- Use standard login with admin credentials
- Verify admin-specific UI elements appear
- Store admin role for test context
- Ensure elevated permissions work
Regular User Login
- Standard authentication flow
- Verify user dashboard loads
- Confirm appropriate access levels
- No admin features visible
Guest Access
- Navigate without login
- Accept any guest prompts
- Verify limited access
- Ensure login prompts appear for restricted content
Troubleshooting
Login State Not Available
Login State Not Available
- Ensure the login test has “Save login state” enabled
- Check if the login test completed successfully
- Verify the correct login test is selected
Session Expiration
Session Expiration
- Consider adding refresh token handling
- Implement automatic re-login when needed
- Use shorter test sequences
State Conflicts
State Conflicts
- Clear cookies/storage in teardown tests
- Use separate login states for different flows
- Implement proper test isolation

