> For the complete documentation index, see [llms.txt](https://asad-razvi.gitbook.io/jest-enzyme-recipes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://asad-razvi.gitbook.io/jest-enzyme-recipes/cypress/how-to-create-a-single-command-from-multiple-commands.md).

# How to create a single command from multiple commands

```javascript
// Store data in ./fixtures/todos.json
[
  { "id": 1, "name": "Eat", isComplete: true },
  { "id": 2, "name": "Sleep", isComplete: false },
  { "id": 3, "name": "Dream", isComplete: false }
]

// Add you custom command in here: support/commands.js
Cypress.Commands.add('seedAndVisit', (seedData = 'fixture:todos') => {
  cy.server()
  cy.route('GET', '/api/todos', seedData)
    .as('loadToComplete')
  cy.visit('/')
  cy.wait('@loadToComplete')
})

// Use fixture data in test file and wait for XHR response before progressing with test
describe('application initialisation', () => {
  it('displays the correct number of items in the todo list', () => {
    cy.seedAndVisit()
    cy.get('.list-item').should('have.length', 3)
  })
})
```
