Many tests require authenticated access. Here's how to handle authentication with AutoSmoke.
Login as Part of the Test
The simplest approach is to include login steps in your test:
Navigate to the login page
Enter "test@example.com" in the email field
Enter "testpassword" in the password field
Click the "Sign In" button
Verify that the dashboard is displayed
# Now continue with your actual test
Click "Settings"
...
Reusable Login Flow
If multiple tests need authentication, create a dedicated login test that other tests can reference:
- Create a test called "Login"
- In other tests, start with "Run the Login test"
Test Account Best Practices
- Use dedicated test accounts, not real user accounts
- Create accounts with predictable, stable data
- Don't use production credentials in tests
- Reset test data periodically if needed
Testing Different User Roles
For applications with multiple user types:
# Admin Test
Navigate to login
Enter admin credentials
Verify admin dashboard features
# Regular User Test
Navigate to login
Enter user credentials
Verify user dashboard (no admin features)
Handling MFA/2FA
For applications with multi-factor authentication:
- Use test accounts with MFA disabled
- Or use a test environment that bypasses MFA
- Contact us for advanced MFA handling options
Session Management
AutoSmoke maintains browser sessions within a test run. This means:
- Cookies persist between steps
- Local storage is maintained
- You stay logged in throughout the test
Each new test run starts with a fresh browser session.