playwright
playwright copied to clipboard
[Docs]: Component testing "best practices" or "pitfalls"
Page(s)
Page: https://playwright.dev/docs/next/test-components#update
I think these topics would be useful to mention:
- Determine what to test
- Determine what not to test (implementation details)
- How to name tests
- Use the appropriate locator
- Emphasise emulation over mocking
- Avoid nesting / describe blocks
- Avoid unnecessary abstractions (Test isolation)
- Ensure your test can fail
@dgozman do you have other topics/changes in mind?
Description
Suggestion from @dgozman to include a "best practices" or "pitfalls" section for component testing: https://github.com/microsoft/playwright/issues/31339#issuecomment-2174162872. I've created a ticket to track this so I don't forget.
do you have other topics/changes in mind?
This looks like a good starting point. If anything, some of these topics might be relevant in e2e best practices as well.