[Playwright] Conditional Tests


  • Run tests with a condition. In my case needed to run some of the tests on a specific environment (CI)


  • Conditional tests with “test.only”

Techstack of my solution:

  • Playwright
  • Jest
  • Typescript


Add your condition before tests. As per my structure

describe()     if() --> conditional implementation



Tests only run if condition passed with given value.

Hope this post may save your time when needed. Happy coding :)




Techie | Traveler | Writer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Glusterfs Journey

<HelloReact/> Day 1 — React from Scratch — 30 Days of React

The complicated relationship between inheritance and generics

picoCTF: Obedient Cat

Wild React 🦒: useForceUpdate()

You ain’t wild, ya mild. Photo: © pixabay @ pexels

A Simple Bus Schedule Viewing App using Flutter

Bus Schedule View Widget

How Much Does It Cost To Create An App Like Discord?

Add a headless CMS to VueJs in 5 minutes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dilshani Subasinghe

Dilshani Subasinghe

Techie | Traveler | Writer

More from Medium

Property-based testing #2: The Essentials of Vintage QuickCheck

Testing Basics(jest)

Application Frameworks (SE3040) Group Project Experience: Online Research Project Management Tool

Which Feedbacks Build Me Up The Most? #GIGIHNotes-On-Feedback