lecture 8 of 180 completed

Logging in once for the whole suite

storageState saves your login to a file so tests start logged in, without depending on each other.

What you'll learn

  • How storageState removes repeated logins
  • Why the file must not be committed
  • How to handle several roles

This one needs a real project: it saves your session to a file on disk, which the editor here has no way to do. It is worth reading anyway, because almost every Playwright suite in a real company uses it.

Logging in through the form takes about three seconds. That sounds small. With eighty tests it is four minutes of every run, spent typing the same password.

You might think: log in once, then let the other tests use that session. Please do not. Your tests would depend on each other, and a single test would fail when run alone.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →