Chain of commands
You cannot "insert" new command into Cypress command chain from outside.
cy.wait(10_000) // sleep 10 seconds
setTimeout(() => {
cy.log('New command!')
}, 5_000)
Instead, you should be able to add commands from other Cypress commands, like cy.then:
cy.log('first').then(() => {
// insert more commands
// before the "LOG third" command
cy.log('second')
})
cy.log('third')
Read the blog post Cypress Cannot Add Out-Of-Band Commands.