Authentication is a crucial part of many test scenarios. Keystone provides flexible options to handle authentication states across your tests.

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

When running tests in parallel, use different accounts for different test suites to prevent state interference.
test_user_1@example.com → Product browsing test suite
test_user_2@example.com → Checkout flow test suite  
test_user_3@example.com → Account settings test suite

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

Auth Modules

Auth modules are pre-built authentication sequences that handle common login patterns:
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

Having trouble with a custom authentication setup? Contact support for personalized assistance in optimizing your test configuration.