Search code examples
debuggingtestingautomated-testscypressui-automation

How can I pause cypress test and try diff 'cy' commands like 'byebug' in ruby?


I'm writing my cypress tests in javascript in VS code. Is there a way in to pause the test run and trial and error different things in terminal/console, something similar to "byebug" in ruby? changing in the code directly and rerunning takes a lot of time.


Solution

  • Basically at the end of your test run or even during a pause, you can use cy.now() in your browser console. cy.now()'s first arg will be the name of the cypress command and the following args will be the cypress command arguments.

    Here is a basic example.

    // test file
    cy.pause()
    
    // in browser console
    cy.now('get', '.your-selector')
    

    A more detailed answer.