Cypress Quick Tip: Selector Playground

07/15/20181 Min Read — In Resources, Testing, Development

When you are running Cypress, day to day, in the course of your development in a kind of squishy TDD/BDD sort of way, you wil find yourself wanted to crank out tests.

Get and Contains are the backbone of your assertions. makes getting at those extremely easy for you. When you are running the test runner, in the right hand side where you browser is, you will see a little target icon.

Select that icon and browse around your state, current and former states, to get a taste of what that target will show you. Click the target symbol, perhaps use the arrow button, and then your selectors will show up in the top, use the Copy button and paste into your spec.js file to get your tests moving fast.

You will find that you are eager to refactor but these convenience selectors will get you going really fast.