Skip to content

Exercise

Here is a great page for practicing acceptance testing: https://www.saucedemo.com/

If you access the page with the standard_user it contains a working web store. When you choose other users the store has bugs and errors, so it's a great service to create a set of tests and see how the tests run depending on the user!

Be sure to have Playwright docs open!
This page in particular should be enough for this exercise.

In this exercise you should create a test suite containing:

Minimum:

  • Create a describe-block for your tests
  • Add a login test to be run before each of your tests
  • Record/write 5-10 different tests
    • Record the tests and tidy them up by hand
    • Do couple of tests by writing them
    • Make the tests to pass with the standard_user

Bonus:

  • Try to parameterize your tests per the username
    • How do the tests pass when you run them with different users?

In the end of this lesson/exercise we will discuss the solutions by looking at teachers solution (the teacher may suck at testing).

I hope that after the lesson and exercise you are familiar with the basics of Playwright and are able to do simple tests with it!