lecture 16 of 190 completed

Stop writing the same login twice

Move repeated setup into your own command. Your tests get shorter, and one change fixes every file.

What you'll learn

  • How to move repeated setup into your own command
  • Why every setup command needs a check at the end
  • When a plain function is the better choice

Open any test file in your project and count how many times you see this:

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →