What’s your favourite Cypress command?
Filip responded with
wow, I’m so enjoying this such a cool question
I really love when I teach using Cypress and people literally freak out when they use network request stubbing, so it has to be combination of
although I’m also really enjoying using
.contains()command. it selects an element using text, which is neat and makes test super readable. also, you can specify this command by using
.contains('button', 'Send')which is just going to select
buttonelements that contain
one more thing comes to mind - some of my favourites are my own custom commands! recently I had a lot of fun rewriting my tests to typescript and creating custom types for them. this meant that I could customize my autocomplete in VS code and make commands that reflected my app logic
And Marie added
I like the
invoke()command because of its versatility. You can invoke any attributes and either query it or update its value. I also like the
cy.request()because with this command, I can test APIs too cypress aliases too
.as()because you can use this with fixtures, data selectors, requests, anything! it’s very handy
What about you? What’s your favourite Cypress command?