Welcome to Part 4 — Integration, the part that separates a toy suite from a real
one: making the API and UI layers work together. We start with the highest-leverage
example — authentication.
Logging in through the UI form on every test is slow (page load + type + submit +
redirect) and repetitive. Playwright's answer is storageState: capture the
browser session — cookies and localStorage — once, save it to disk, and load it
into any test so it opens already authenticated.
Code for this chapter is tagged
ch-15in the repo:
and tell me how many seconds storageState shaved off your suite.
SOCIAL SHARE CARD GENERATOR