Cleanup
Loading "Test Isolation in End to End Testing"
Run locally for transcripts
π¦ Test isolation is no joke. When you don't have test isolation, you can easily
get into a situation where one test is affecting the results of another test.
Running all the tests together can have a different outcome than running them
individually. This is a nightmare to debug.
Test isolation means that each test is independent of the others. Each test
should be able to run in any order, and the results should be the same. In
practice this means you need to have each test handle its own setup and cleanup.
π¨βπΌ Go ahead and try running the test a few times. It probably works, but you may
notice something funny if you open the app and go to the user's page. After
running the test a few times, you should find more and more users on the users
page! This is annoying at best, and can break other tests at worst.
The solution to this is simple. We just need to delete the user we created! Make
this adjustment and try again.
npx playwright test --ui
You can reseed the database to get rid of the old ones if you want.
npx prisma db seed