
Usecase:
- Run tests with a condition. In my case needed to run some of the tests on a specific environment (CI)
Solution:
- Conditional tests with “test.only”
Techstack of my solution:
- Playwright
- Jest
- Typescript
Implementation:
Add your condition before tests. As per my structure
describe() if() --> conditional implementation
it()
it()
Tests only run if condition passed with given value.
Hope this post may save your time when needed. Happy coding :)