# What's Your Favourite Cypress Command?

**URL:** <https://club.ministryoftesting.com/t/whats-your-favourite-cypress-command/41210>\
**Category:** Archive\
**Tags:** automation\
**Created:** [31 July 2020 08:30 UTC](https://club.ministryoftesting.com/t/whats-your-favourite-cypress-command/41210 "2020-07-31T08:30:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![heather\_reid](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/heather_reid/32/29_2.png) [@heather\_reid](https://club.ministryoftesting.com/u/heather_reid)\
**Post date:** [31 July 2020 08:30 UTC](https://club.ministryoftesting.com/t/whats-your-favourite-cypress-command/41210/1 "2020-07-31T08:30:11Z")

</div>

This was a really fun question from @rightsaidjames in the Slack Ask Me Anything with @marie.drake and Filip Hric

> 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 `.server()`  
> `.route()`  
> `.as()`  
> and  
> `.wait()`  
> 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 `button` elements that contain `Send` text.
> 
> 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?

---

<div class="post-metadata">

**Author:** ![ian808](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@ian808](https://club.ministryoftesting.com/u/ian808)\
**Post date:** [31 July 2020 08:57 UTC](https://club.ministryoftesting.com/t/whats-your-favourite-cypress-command/41210/2 "2020-07-31T08:57:25Z")

</div>

I am all about that cy.request() life now. I used to run a POSTMAN script to set up my test users before the test run which worked(ish). Now I get Cypress to make the API calls to set up and tear down before each tests. Keeps things nice and tidy. 🙂
