> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurtest.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Login States

> Manage authentication across your tests efficiently by reusing login sessions and avoiding redundant authentication steps.

## What are Login States?

Login states in Spur allow you to manage authentication across your tests efficiently. Authentication is a crucial part of many test scenarios.

Spur provides flexible options to handle authentication states across your tests, enabling you to start tests from authenticated states or save login states for reuse. Configure these settings in Test Editing Side Peek.

<Frame caption="Overview of Login States ">
  <img src="https://mintcdn.com/spur/H3xqe3VyV7YeO-e5/images/Screenshot2026-02-05at1.32.13PM.png?fit=max&auto=format&n=H3xqe3VyV7YeO-e5&q=85&s=8b0205bbf42ba9d3d5f237195db4ccb0" alt="Screenshot 2026 02 05 At 1 32 13 PM" width="1116" height="306" data-path="images/Screenshot2026-02-05at1.32.13PM.png" />
</Frame>

## Before and After Login States

Without login states, every test that requires authentication must include its own login steps, adding redundancy and slowing down execution. With login states, you save a login session once and reuse it across tests, so they skip straight to the actual workflow.

<Columns cols={2}>
  <Frame caption="Before: Login steps are repeated in every test">
    <img src="https://mintcdn.com/spur/ZCr4ugsX6qHth4n4/images/login-states-before.png?fit=max&auto=format&n=ZCr4ugsX6qHth4n4&q=85&s=38993c9fd81a4d6a92c70b9161273d05" alt="Test with login steps included" width="655" height="508" data-path="images/login-states-before.png" />
  </Frame>

  <Frame caption="After: Test skips login and starts from the authenticated state">
    <img src="https://mintcdn.com/spur/ZCr4ugsX6qHth4n4/images/login-states-after.png?fit=max&auto=format&n=ZCr4ugsX6qHth4n4&q=85&s=c5350184f9fe10d59345f8914169b2ef" alt="Test skipping login steps" width="728" height="508" data-path="images/login-states-after.png" />
  </Frame>
</Columns>

## How to Configure Login States

<Steps>
  <Step title="Navigate to Test Side Peek">
    During test creation in Test Side Peek, check below for more information about Login States options.

    <Frame>
      <img src="https://mintcdn.com/spur/BvhWQtDOy3g9ZJZN/images/step1login.gif?s=bf306531369cd360102f235890777890" alt="Step1login" width="1960" height="1080" data-path="images/step1login.gif" />
    </Frame>
  </Step>

  <Step title="Choose Your Login State Configuration">
    Select the appropriate login state option based on your testing needs.

    <Steps>
      <Step title="Start from Logged-in State">
        Begin this test using the login state from another test. This allows tests to skip login steps and start directly from an authenticated state, reducing execution time and improving test efficiency.

        You can also use Scenario Tables to organize and select login tests directly, streamlining authentication management across multiple test configurations.

        **How it works:**

        <Frame>
          <img src="https://mintcdn.com/spur/BvhWQtDOy3g9ZJZN/images/step2.1login.gif?s=2ae5dcbecaeb838c62eda2ac6ca4688a" alt="Step2 1login" width="880" height="1080" data-path="images/step2.1login.gif" />
        </Frame>

        1. Check "Start from logged-in state"
        2. Select a login test from the dropdown
        3. Your test will begin with the authentication state from the selected test

        <Accordion title="Use Cases">
          * Tests that require an authenticated user
          * Avoiding redundant login steps
          * Maintaining consistent test state
        </Accordion>
      </Step>

      <Step title="Save Login State for Other Tests">
        Make this test's login state available for other tests to use. Ideal for creating dedicated login tests that other tests can reference.

        <Note>
          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.
        </Note>

        **How it works:**

        <Frame>
          <img src="https://mintcdn.com/spur/H3xqe3VyV7YeO-e5/images/Screenshot2026-02-05at1.25.20PM.png?fit=max&auto=format&n=H3xqe3VyV7YeO-e5&q=85&s=4762ed8ae8a64a86685ca2ffd8af5ea3" alt="Screenshot 2026 02 05 At 1 25 20 PM" width="1082" height="106" data-path="images/Screenshot2026-02-05at1.25.20PM.png" />
        </Frame>

        1. Check "Save login state for other tests"
        2. Complete your login test
        3. Other tests can now select this test as their login state source

        <Accordion title="Use Cases">
          * Creating reusable login tests
          * Making authentication states available across test suites
          * Reducing test execution time
        </Accordion>
      </Step>
    </Steps>
  </Step>
</Steps>

## Parallel Test Execution with Multiple Accounts

When running tests in parallel, it's recommended to use different accounts for different test suites to prevent state interference.

**This ensures:**

* Tests can run simultaneously without affecting each other's states
* Each test suite has its own isolated authentication context
* Changes made in one test suite won't impact the others
* You can maintain predictable test behavior in parallel execution

## Best Practices

**Create Dedicated Login Tests**

* Make separate tests for different user roles
* Keep login tests focused and minimal
* Use clear naming conventions (e.g., "Admin Login", "Customer Login")

**State Management**

* Save login states from tests that perform authentication
* Reuse login states to reduce test 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 when needed

<Warning>
  If you're experiencing issues with authentication in custom configurations, please reach out to the Spur team. We're here to help optimize authentication for your specific setup.
</Warning>
