Skip to content

Error: Unexpected state in afterSpecHandler when chrome browser crashes #1172

@AMEntwistle

Description

@AMEntwistle

Current Behaviour

When the chrome browser crashes during test execution, an error is thrown and the plugin does not exit gracefully:

Error: Unexpected state in afterSpecHandler: step-started (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)
    at createError (/Users/entw003/Repos/cucumber-cypress-tests/node_modules/@badeball/cypress-cucumber-preprocessor/dist/helpers/error.js:9:12)
    at afterSpecHandler (/Users/entw003/Repos/cucumber-cypress-tests/node_modules/@badeball/cypress-cucumber-preprocessor/dist/plugin-event-handlers.js:276:43)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.handler (/Users/entw003/Repos/cucumber-cypress-tests/node_modules/cypress-on-fix/index.js:32:20)

Desired Behaviour

It would be great if the plugin would handle this error. Currently this throws cypress into an exit which means other plugins depending that run after this may not run. In our instance this actually leads to false positives. Chrome memory errors have been an issue with cypress for some time now so being able to handle this scenario would be beneficial.

Test code to reproduce

  1. Add a cy.pause() to a test
  2. Run the test in headed mod, e.g cypress run --env TAGS="@Focus" --browser chrome --headed
  3. When you hit the pause, trigger the crash by pasting this into the browser:chrome://inducebrowsercrashforrealz

-->

Versions

  • Cypress version: 13.6.6
  • Preprocessor version: 20.0.2
  • Node version: 18.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions