The Concierge Desk · Cookies & Storage

Cookies, localStorage and sessionStorage side by side: write a value, read it back, and watch which survive a reload and which die with the tab.

Cookies, localStorage, sessionStorage — three registers, and only some survive the night.

Cookies & Storage is a medium Network & Auth challenge on Fun UI Playground. Cookies, localStorage and sessionStorage side by side: write a value, read it back, and watch which survive a reload and which die with the tab. It runs entirely in the browser, with no backend. Every interactive element carries a stable id and data-testid prefixed with “cookies-”, and the techniques it exercises are read/write cookies, localStorage vs sessionStorage, state persistence, assert storage values.

At a glance

Category
Network & Auth
Difficulty
medium
Teaches
read/write cookies · localStorage vs sessionStorage · state persistence · assert storage values
Backend
None — runs entirely in the browser
Locators
Stable id and data-testid, prefixed cookies-

Selectors on this page

LocatorWhat it is
#cookies-name #cookies-value #cookies-set #cookies-clearCookie jar: #cookies-name + #cookies-value, set with #cookies-set, cleared with #cookies-clear
#cookies-readoutdocument.cookie is echoed into #cookies-readout — assert there, or read cookies from your driver
#cookies-local-key #cookies-local-value #cookies-local-set #cookies-session-set #cookies-storage-clearStorage: #cookies-local-key + #cookies-local-value written via #cookies-local-set (localStorage) or #cookies-session-set (sessionStorage), cleared with #cookies-storage-clear
#cookies-storage-readoutBoth stores are dumped (funui-demo-* keys) into #cookies-storage-readout; JS-set cookies are never HttpOnly

Frequently asked questions

How do I read and assert cookies in a test?

Set one with #cookies-name / #cookies-value and #cookies-set, then assert either the page's echo of document.cookie in #cookies-readout or the cookie jar your driver exposes. Cookies set from JavaScript are never HttpOnly, so both routes can see them.

What is the difference between localStorage and sessionStorage here?

localStorage (written by #cookies-local-set) survives a reload; sessionStorage (#cookies-session-set) dies with the tab. Both stores are dumped as funui-demo-* keys into #cookies-storage-readout, so the difference is assertable without devtools.

More Network & Auth

Updated

Fun UI Playground — all challenges, bug hunts, getting started, glossary, about.