Storefront Logout Test Plan

User logout and session termination tests

Version: 1.0
Last Updated: December 10, 2025
Total Test Cases: 6

Overview

The logout functionality allows authenticated users to securely end their session. This involves clearing authentication tokens, invalidating the session on the server, and redirecting to the appropriate page.

Logout Flow

Click Logout
Clear Token
API Call
Redirect

Test Cases: Basic Logout

TC-SF-LOGOUT-001 Successful Logout from Header Menu
High

Objective: Verify that users can successfully log out using the header menu.

Precondition: User is logged in.

  1. Click on the user profile icon/avatar in the header
    Dropdown menu appears with user options
  2. Click on "Logout" or "Sign Out" option
    • User session is terminated
    • Auth token is cleared from localStorage/cookies
    • User is redirected to homepage (/)
    • Header shows "Login" button instead of user avatar
  3. Try to access a protected page (e.g., /account, /orders)
    User is redirected to login page
TC-SF-LOGOUT-002 Logout from Account/Profile Page
Medium

Objective: Verify that users can log out from their account page.

Precondition: User is logged in.

  1. Navigate to Account/Profile page (/account)
    Account page loads with user information
  2. Locate and click the "Logout" button (typically at bottom of account menu)
    • User is logged out successfully
    • Redirected to homepage or login page
    • Session is cleared

Test Cases: Session Handling

TC-SF-LOGOUT-003 Session Token Cleared After Logout
High

Objective: Verify that auth tokens are properly cleared from browser storage after logout.

Precondition: User is logged in.

  1. Open browser DevTools (F12) > Application > Local Storage
    Auth token is visible in storage (e.g., "auth_token" or "access_token")
  2. Perform logout action
    Logout completes
  3. Check Local Storage again
    • Auth token is removed from localStorage
    • Any session-related cookies are cleared
  4. Refresh the page
    User remains logged out (not automatically re-authenticated)
TC-SF-LOGOUT-004 Back Button After Logout
Medium

Objective: Verify that using browser back button after logout doesn't restore the session.

Precondition: User was logged in and has just logged out.

  1. After successful logout, click browser's Back button
    • User is NOT shown the previous logged-in page with cached data
    • If cached page is shown, it should not allow any authenticated actions
    • Any attempt to perform authenticated action redirects to login
  2. Try to refresh the page
    Page shows logged-out state or redirects to login
TC-SF-LOGOUT-005 Cart Preservation After Logout
Medium

Objective: Verify cart behavior when user logs out (based on business requirements).

Precondition: User is logged in with items in cart.

  1. Add some items to cart while logged in
    Items are added to cart
  2. Note the cart count in header
    Cart shows item count (e.g., "3")
  3. Perform logout
    User is logged out
  4. Check cart after logout
    • Option A: Cart is cleared (user-specific cart)
    • Option B: Cart is preserved for guest checkout
    • Behavior should match business requirements
Note: The expected behavior depends on the business decision. Document the actual behavior and verify it matches requirements.

Test Cases: Edge Cases

TC-SF-LOGOUT-006 Logout with Network Error
Low

Objective: Verify logout behavior when network is unavailable.

Precondition: User is logged in.

  1. Open DevTools > Network tab
    Network tab is open
  2. Set network to "Offline" mode
    Network is simulated as offline
  3. Attempt to logout
    • Error message may be shown (network unavailable)
    • OR: Local logout proceeds (token cleared locally) even if server call fails
    • User should not be stuck in logged-in state indefinitely
  4. Re-enable network and refresh
    State is consistent (either logged in or logged out, not corrupted)

Pre-Test Checklist

Environment URLs

Environment Storefront URL Account Page
Local http://localhost:4000 http://localhost:4000/account
Development https://dev-store.bizplaza.in https://dev-store.bizplaza.in/account
Staging https://staging-store.bizplaza.in https://staging-store.bizplaza.in/account