Authentication Testing

Logout Test Cases That Prove the Old Session Cannot Be Reused

A practical set of 50 logout test cases covering session invalidation, old-token replay, refresh tokens, browser history, tabs, devices, SSO and accessibility.

2026-07-28 Approximately 13 min read

A complete logout test must verify that:

  • the intended current, selected or global session scope is terminated
  • the server rejects the old session identifier and bearer token
  • refresh and remember-me mechanisms cannot silently recreate the terminated access
  • protected pages and APIs stop returning authenticated data
  • Back, restored tabs, browser cache and service workers do not restore live access
  • other tabs, devices and federated applications follow the documented termination policy
  • pending forms, uploads and transactions cross the logout boundary safely
  • a later login creates a fresh session while the old state remains unusable

This guide contains 50 practical logout test cases covering user interface, server invalidation, cookies and tokens, browser history, tabs, devices, remember me, refresh races, SSO, resilience and accessibility.

Use the Session Management Test Cases guide for timeout and revocation behaviour. Use the Login Page Test Cases guide for the fresh authentication journey after logout.

Logout lifecycle showing request, server-side session invalidation, old-token rejection, browser cleanup and fresh authentication
Logout lifecycle showing request, server-side session invalidation, old-token rejection, browser cleanup and fresh authentication

The Minimum Logout Smoke Test

When release time is limited, begin with these ten cases.

Minimum Logout Smoke Test
IDTestWhat it proves
LOG-01Activate logout from a protected pageThe user can intentionally start termination.
LOG-07Verify the post-logout destinationThe browser reaches a safe public or login state.
LOG-08Inspect the server-side session after logoutThe intended session is terminated, not only hidden in the UI.
LOG-09Replay the old session cookie against a protected pageThe server rejects the previous browser session.
LOG-10Replay the old bearer token against a protected APIAPI access does not survive browser logout.
LOG-20Attempt refresh with the old refresh tokenA background refresh cannot recreate access.
LOG-23Use Back and reload after logoutCached pages do not become live authenticated access.
LOG-27Logout in one tab and use another tabShared browser contexts converge on the terminated state.
LOG-32Use log out all devicesEvery session in the requested scope becomes unusable.
LOG-46Replay a copied SSO artifact after logoutFederated logout revokes the trusted authentication artifact.

The smoke set proves the primary transition. It does not replace timeout testing, token cryptography review, provider-specific protocol conformance or complete accessibility testing.

Define the Logout Acceptance Contract First

Logout expected results are unreliable until the termination policy is explicit.

Logout Acceptance Contract
Contract elementQuestion to answer
ScopeDoes the action terminate the current session, selected device, all sessions or the federated ecosystem?
InitiatorCan the user, administrator, application, IdP or security event initiate termination?
ArtifactsWhich cookies, access tokens, refresh tokens, WebSocket credentials and SSO artifacts represent the session?
Server stateHow is the session marked destroyed, revoked or no longer accepted?
Browser stateWhich cookies, local storage, IndexedDB, cache and service-worker data are cleared or ignored?
TabsHow do other tabs learn that the shared session ended?
DevicesWhich other sessions remain active after current-session logout?
Remember meIs persistent account convenience preserved, revoked or converted into a limited reauthentication path?
RefreshCan an in-flight or stored refresh token issue new access after logout?
FederationDoes local logout also end the IdP session or sessions at other relying parties?
Pending workWhat happens to unsaved forms, uploads, payments and queued requests?
FailureWhat does the UI show when server-side termination fails?
EvidenceWhich browser, network, store and audit observations prove the result?

Example logout acceptance contract

Example Logout Acceptance Contract
Input stateExpected browser resultExpected system result
Current-session logoutSafe destination and authenticated UI removedOnly the current server session is invalidated
Log out all devicesCurrent browser ends and session list emptiesEvery active session in scope is revoked
Old cookie restored after logoutProtected page remains unavailableServer rejects the old identifier
Old refresh token used after logoutNo silent return to authenticated UIRefresh request is rejected
Remember-me evidence remainsProduct follows documented convenience or reauthentication flowTerminated privileged session is not resurrected
SSO local logoutApplication session endsIdP session follows explicit local/global policy
Logout server failureUI reports failure or retries safelyNo false claim that termination succeeded

Model Logout as a State Transition

Logout state model from authenticated session through scope resolution, server invalidation, artifact revocation, protected request rejection and fresh login
Logout state model from authenticated session through scope resolution, server invalidation, artifact revocation, protected request rejection and fresh login

Logout transforms an authenticated system state into a terminated state with explicit scope.

  1. Authenticated session
  2. Logout requested
  3. Scope resolved
  4. Server session invalidated
  5. Access and refresh artifacts revoked
  6. Background channels closed or rejected
  7. Browser state cleared or ignored
  8. Protected requests rejected
  9. Safe public or reauthentication state
  10. Fresh login creates a new session

Prohibited transitions

Prohibited logout transitions
StateMust not transition to
Logout UI shownOld protected API still accepted
Old refresh tokenNew access token
Remember-me evidenceRestored terminated privileged session
Local SSO logout marked globalOther trusted applications authenticated

Logout Entry and User Interface Test Cases

Logout Entry and User Interface Test Cases
IDScenarioExpected resultEvidence
LOG-01Activate logout from every protected area where the control is expectedThe control is visible, recognisable and reaches the same termination contractUI inventory and resulting request
LOG-02Reach and activate logout using keyboard and assistive technologyThe control has an accessible name, keyboard focus and operable semanticsAccessibility tree and keyboard path
LOG-03Activate logout once under normal network conditionsOne termination request is sent and the final state is stableNetwork log and final browser state
LOG-04Double-click or rapidly activate logout several timesThe operation is idempotent and does not create an error or inconsistent stateRequest sequence and final server state
LOG-05Call the logout endpoint directly with a valid authenticated sessionThe documented endpoint terminates the intended scope without relying on page navigationHTTP response and session-store state
LOG-06Open the logout route while already anonymousThe application returns a safe idempotent public result without creating a sessionResponse, cookies and destination
LOG-07Verify the configured post-logout destination and return URL handlingThe user reaches an allowed public or login destination and cannot be redirected to an untrusted locationRedirect chain and final origin

Server-Side Session Invalidation Test Cases

Server-Side Session Invalidation Test Cases
IDScenarioExpected resultEvidence
LOG-08Inspect the current session record after logoutThe intended server-side session is destroyed, revoked or no longer acceptedSession-store state and timestamp
LOG-09Restore and replay the old session cookie against a protected pageThe server rejects it and returns no protected contentProtected response and session-store lookup
LOG-10Replay the old bearer token against representative protected APIsEvery tested API rejects the token and returns no protected dataHTTP status, body and audit event
LOG-11Use the old session on a high-risk route not visited during logoutSecurity-critical routes recognise termination consistentlyProtected route response
LOG-12Attempt a state-changing request with the old sessionThe operation is rejected and creates no business recordAPI response and persisted state
LOG-13Log in again after logout and compare session identifiersFresh authentication creates a new session; the old identifier remains invalidOld/new identifiers and replay result
LOG-14Logout from one role or tenant and authenticate as another in the same browserNo identity, tenant, role or cached protected data crosses the account switchFinal identity, storage and protected responses
LOG-15Use a current-session logout when several independent sessions existOnly the current session is invalidated unless the contract says otherwiseSession list and results from each context

OWASP recommends capturing the original session cookies, invoking logout, restoring the old values and testing several protected pages to prove server-side invalidation.

Back, Cache, Restored Tab and Browser History Test Cases

Back, Cache, Restored Tab and Browser History Test Cases
IDScenarioExpected resultEvidence
LOG-23Use Back immediately after logout, then reloadCached protected content is not treated as live access and the server rejects the page requestHistory view, reload and network response
LOG-24Open a protected URL from browser history after logoutThe application requires authentication and returns no sensitive dataNavigation response and final page
LOG-25Close and restore a protected tab after logoutRestored state cannot re-establish the old sessionRestored storage and protected requests
LOG-26Open a bookmark or copied deep link to a protected page after logoutThe route follows the unauthenticated-entry contractRedirect and protected API response

Multiple Tabs, Background Requests and Offline Test Cases

Logout testing across tabs, devices, background channels, offline queues and session propagation
Logout testing across tabs, devices, background channels, offline queues and session propagation
Multiple Tabs, Background Requests and Offline Test Cases
IDScenarioExpected resultEvidence
LOG-27Logout in Tab A while Tab B remains openTab B detects the ended shared session on the next relevant event and cannot act as authenticatedBoth tab states and requests
LOG-28Logout while polling, WebSocket or server-sent events are activeBackground channels close or stop receiving protected dataChannel status and messages after logout
LOG-29Submit a protected form from another tab after logoutThe request is rejected safely and creates no duplicate or partial recordSubmission response and persisted data
LOG-30Queue a request offline, logout elsewhere, then reconnectThe queued request cannot succeed with the terminated sessionOffline queue and retry response

Device and Concurrent Session Logout Test Cases

Device and Concurrent Session Logout Test Cases
IDScenarioExpected resultEvidence
LOG-31Logout the current session while the same account is active on another permitted deviceThe other device follows the current-session policy and remains or ends intentionallyPer-device session results
LOG-32Use log out all devicesEvery active session in scope is revoked and old tokens failSession list and replay from each device
LOG-33Terminate one selected device from an active-session management screenOnly the selected session is revokedSession list and both device results
LOG-34Refresh the active-session list after local or remote logoutThe list reflects the final server state without stale entriesSession inventory and timestamps
LOG-35Use the same copied authentication artifact in two browser contexts, then logout oneRevocation follows artifact and session scope; undocumented shared access does not surviveArtifact replay across contexts
LOG-36Logout after step-up or high-assurance authentication on one deviceThe intended base and elevated session state are terminated according to policyAssurance state and protected-action result

Remember Me, Refresh Token and Reauthentication Test Cases

Remember Me, Refresh Token and Reauthentication Test Cases
IDScenarioExpected resultEvidence
LOG-37Logout while remember-me evidence existsThe terminated authenticated session is not silently restoredNext visit, persistent token and session creation
LOG-38Preserve a remembered username when policy allows itConvenience data remains separate from authenticated accessDisplayed identifier and protected-state check
LOG-39Authenticate again with remember me after logoutA new session is created and the old session remains invalidOld/new identifiers and token records
LOG-40Use a stored refresh token from another tab or process after logoutThe refresh path remains revoked across contextsRefresh response and resulting session list
LOG-41Attempt a sensitive action after logout and then reauthenticateThe old state cannot authorise the action; fresh authentication creates the permitted stateAction result, authentication time and new session

SSO and Federated Logout Test Cases

SSO and Federated Logout Test Cases
IDScenarioExpected resultEvidence
LOG-42Logout only from the relying-party application while the IdP session remains activeLocal session termination and subsequent silent or prompted re-entry follow the documented policyRP and IdP session states
LOG-43Logout from the identity provider while the application session remains openThe application detects or handles upstream termination according to its federation contractIdP state and RP protected requests
LOG-44Use a global logout action across several relying partiesEvery participating application in scope terminates its trusted sessionResults from each relying party
LOG-45Test registered and unregistered post-logout redirect destinationsOnly permitted destinations are acceptedLogout request and redirect result
LOG-46Copy an authentication-critical SSO artifact to another device, then logoutThe copied artifact is rejected across all trusting applications after server-side revocationCross-device replay and relying-party responses

Federated logout must distinguish the relying-party session from the identity-provider session and any sessions at other relying parties.

Pending Work, Resilience and Accessibility Test Cases

Pending Work, Resilience and Accessibility Test Cases
IDScenarioExpected resultEvidence
LOG-47Lose the network after logout is requested but before the response completesThe UI reports uncertain or failed termination honestly and recovers to a deterministic stateRequest status, retry and final session state
LOG-48Make the logout service return an errorThe interface does not claim success while the session remains validError UI and old-token replay
LOG-49Logout during an upload, payment, long request or multi-step transactionThe operation commits, cancels or requires recovery according to one documented atomicity ruleBusiness record, response and session state
LOG-50Complete logout with keyboard and screen reader, then verify focus and announcementTermination result is perceivable, focus moves predictably and the next action is accessibleAccessibility tree, announcement and focus order

The Most Important Logout Failure Patterns

Logout failures including browser-server disagreement, valid old tokens, tab inconsistency, refresh races, remember-me restoration and false success
Logout failures including browser-server disagreement, valid old tokens, tab inconsistency, refresh races, remember-me restoration and false success

The browser says logged out, but the API still works

A redirect or removed navigation can hide a still-valid token. Replay the old cookie and bearer token against representative protected resources.

Deleting a browser cookie prevents that browser from presenting the token, but it does not invalidate copied or stolen values. Inspect the session store and replay the original value.

One tab logs out while another remains authenticated

Tabs sharing one session need a deterministic propagation rule. The second tab must not continue performing protected actions with stale state.

Remember me restores the terminated session

Persistent convenience evidence must not recreate the exact privileged state that the user explicitly terminated.

A refresh request recreates access during logout

An in-flight refresh can issue a new token after the logout request unless revocation and token issuance have an atomic ordering rule.

Local logout leaves the identity-provider session active

This may be correct, but it must be explicit. A user can appear logged out and immediately return through silent SSO if the IdP session remains valid.

The interface reports success after server failure

A success page is dangerous when the old token still works. Treat logout failure as a state that must be surfaced or retried honestly.

A pending operation crosses the logout boundary incorrectly

A transaction can commit after the user believes the session ended, or fail after partial persistence. Define the atomicity boundary and verify the stored result.

What Each Testing Layer Can Prove

Logout Testing Layers
LayerWhat it can verifyWhat it cannot prove alone
Browser testControl visibility, redirect, Back, cache, tabs, focus, storage and visible account stateServer invalidation across every API and device
Protected API testOld-cookie, bearer-token and refresh-token rejectionUser-facing recovery and accessibility
Session-store testDestroyed, revoked or selected-session scope and timestampsThat cached browser content is handled safely
Token-service testAccess and refresh revocation, race ordering and token issuanceComplete browser and SSO experience
Background-channel testPolling, WebSocket, SSE, upload and offline-queue behaviourFull page navigation and assistive technology
Device/session inventory testCurrent, selected and all-device terminationFederated provider state unless integrated
Federation testRP, IdP and other relying-party session terminationLocal application storage and pending work
Audit testActor, scope, time, affected session and suspicious replay eventsThat access was actually blocked
Accessibility evaluationControl name, keyboard operation, result announcement and focusServer-side token revocation
Logout testing layers covering browser state, protected APIs, session store, tokens, background channels, devices, federation, audit and accessibility
Logout testing layers covering browser state, protected APIs, session store, tokens, background channels, devices, federation, audit and accessibility

Automating Logout Test Cases

A reusable logout journey should capture the authenticated artifacts before termination, perform the requested scope and prove rejection afterwards.

  1. Authenticate as {{USER}}
  2. Capture {{SESSION_COOKIE}}
  3. Capture {{ACCESS_TOKEN}}
  4. Capture {{REFRESH_TOKEN}}
  5. Open {{CONTEXTS_OR_DEVICES}}
  6. Start {{BACKGROUND_OR_PENDING_OPERATION}}
  7. Invoke logout with {{SCOPE}}
  8. Assert {{LOGOUT_RESPONSE}}
  9. Assert {{SESSION_STORE_STATE}}
  10. Replay old cookie
  11. Replay old access token
  12. Attempt refresh
  13. Assert protected requests rejected
  14. Assert browser contexts updated
  15. Authenticate again
  16. Assert new session differs from old session

Current-session dataset

{
  "name": "current_session_logout_rejects_old_artifacts",
  "scope": "current-session",
  "contexts": [
    "tab-a",
    "tab-b"
  ],
  "expected": {
    "currentSession": "revoked",
    "otherDeviceSession": "unchanged",
    "oldCookieAccepted": false,
    "oldAccessTokenAccepted": false,
    "oldRefreshTokenAccepted": false
  }
}

Global logout dataset

{
  "name": "logout_all_devices_revokes_every_session",
  "scope": "all-sessions",
  "devices": [
    "desktop",
    "mobile",
    "secondary-browser"
  ],
  "expected": {
    "activeSessionCount": 0,
    "allOldTokensAccepted": false,
    "freshAuthenticationRequired": true
  }
}

Federated logout dataset

{
  "name": "global_sso_logout_reaches_trusting_apps",
  "scope": "federated-global",
  "relyingParties": [
    "app-a",
    "app-b"
  ],
  "expected": {
    "idpSession": "terminated",
    "appASession": "terminated",
    "appBSession": "terminated",
    "copiedArtifactAccepted": false
  }
}

What Browser Automation Should Not Claim

  • session identifiers and tokens have sufficient entropy
  • every token-signing and validation implementation is cryptographically secure
  • distributed revocation reaches every production node within its latency objective
  • all stolen-token and session-hijacking techniques are prevented
  • every identity-provider logout protocol is conformant
  • native mobile secure storage is correctly cleared
  • every service worker and browser-cache implementation is secure
  • audit logs are complete across all infrastructure components
  • logout succeeded merely because the browser reached a login page

Browser automation remains essential because it proves the real user action, context propagation, Back and cache behaviour, pending work, accessibility and fresh reauthentication.

Logout Testing Checklist

  • logout scope is defined as current, selected, all-session or federated global
  • the logout control is visible, recognisable and accessible on intended protected pages
  • duplicate logout requests are idempotent
  • the post-logout destination is safe and rejects untrusted return URLs
  • the intended server-side session is destroyed or revoked
  • old cookies and bearer tokens fail on representative protected resources
  • state-changing requests with old artifacts create no business record
  • fresh login creates a new session and the old identifier remains invalid
  • all authentication-relevant cookie domains and paths are covered
  • restored local storage and IndexedDB cannot recreate access
  • service workers and cached shells return no live protected data
  • old refresh tokens cannot issue new access after logout
  • refresh and logout races end in a terminated state
  • logout audit events record actor, scope and affected session safely
  • Back, reload, history, bookmarks and restored tabs require authentication
  • other tabs cannot continue protected activity with stale state
  • polling, WebSocket, SSE and background channels stop receiving protected data
  • offline queued requests fail safely after termination
  • current-session logout does not unintentionally revoke other devices
  • log out all devices revokes every session in scope
  • selected-device termination affects only the selected session
  • session inventory reflects local and remote logout accurately
  • remember-me data does not restore the terminated privileged session
  • remembered identifiers remain separate from authenticated access
  • sensitive actions after logout require fresh authentication
  • local and global SSO logout policies are distinguished
  • registered post-logout redirect destinations are enforced
  • copied SSO artifacts fail after server-side revocation
  • network and server failures do not create false logout success
  • uploads, payments and long operations have a deterministic logout boundary
  • screen-reader announcement, focus and next action remain accessible

Frequently Asked Questions

What are the most important logout test cases?

Verify server-side session invalidation, replay of old cookies and access tokens, refresh-token rejection, Back and cache behaviour, multiple tabs, device scope, remember me, SSO and fresh authentication.

Does redirecting to the login page prove logout?

No. The browser may have changed while the server still accepts the old session. Replay the original authentication artifacts against protected resources.

Should logout terminate every device?

Only if the product defines the action as global logout. Current-session, selected-device and all-device logout need separate contracts and test cases.

What should happen to remember me after logout?

The documented convenience behaviour may remain, but it must not resurrect the terminated authenticated session or bypass required authentication.

How should SSO logout be tested?

Test the relying-party session, identity-provider session, other relying parties, post-logout redirect rules and replay of the authentication-critical artifact as separate states.

Can logout test cases be automated?

Yes. Browser automation can capture session artifacts, invoke logout, replay cookies and tokens through APIs, verify tabs and devices, and confirm that fresh login creates a new session.

Automate the Repeatable Logout Journey

WrightTest lets teams record the visible logout flow, replace fixed users and termination scopes with named datasets, and inspect screenshots, step results, errors and Playwright traces.

Reusable logout automation flow with datasets for current-session, all-device and federated termination cases
Reusable logout automation flow with datasets for current-session, all-device and federated termination cases
  1. Which session and device started the test
  2. Which logout scope was requested
  3. Which artifacts existed before termination
  4. Whether the server revoked the session
  5. Whether old cookie, access token and refresh token failed
  6. Whether tabs and background channels agreed
  7. Whether SSO applications followed the expected scope
  8. Whether fresh authentication created a new session

Combine the browser journey with API replay and isolated session fixtures so the suite proves server invalidation without depending only on visible navigation.

Browser checks can be exported to Playwright .spec.ts files when they need to move into an existing repository or CI pipeline.

Continue with Authentication Testing

Logout completes the authentication lifecycle. Use the Authentication Testing guide to plan coverage across login, MFA, session state and termination.