Closed sgnsabir closed 3 months ago
This is explained in the documentation linked from the error message. Use cypress-on-fix
.
Thanks
On Sun, 30 Jun 2024, 5:50 pm Jonas Amundsen, @.***> wrote:
Closed #1207 https://github.com/badeball/cypress-cucumber-preprocessor/issues/1207 as completed.
— Reply to this email directly, view it on GitHub https://github.com/badeball/cypress-cucumber-preprocessor/issues/1207#event-13342467113, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARET3BHESHAYDM3OAQLP2JDZKASMTAVCNFSM6AAAAABKEGPYMSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGM2DENBWG4YTCMY . You are receiving this because you authored the thread.Message ID: <badeball/cypress-cucumber-preprocessor/issue/1207/issue_event/13342467113 @github.com>
While I am running npx cypress open, in test runner it is executing without any error. However when I run the same cypress project in terminal by "npx cypress run", I encountered following error. Please help! PS E:\Tutorials\actionSQA\Cypress\CypressFramework> npx cypress run
DevTools listening on ws://127.0.0.1:53974/devtools/browser/b96142ad-f719-4815-884a-aa20539994a6
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 13.12.0 │ │ Browser: Electron 118 (headless) │ │ Node Version: v20.13.1 (C:\Program Files\nodejs\node.exe) │ │ Specs: 19 found (BDD/ecommerce.feature, JS/AutomationPracticeTest1.js, JS/AutomationP │ │ racticeTest2.js, JS/AutomationPracticeTest3.js, JS/AutomationPracticeTest4.js, │ │ JS/AutomationPracticeTest5.js, JS/AutomationPracticeTest6.js, JS/AutomationPr │ │ acticeTest7.js, JS/Auto...) │ │ Searched: cypress/integration/examples/*/.{js,feature,ts,tsx} │ └────────────────────────────────────────────────────────────────────────────────────────────────┘
Remove output folder E:\Tutorials\actionSQA\Cypress\CypressFramework\cypress\reports\html
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: BDD/ecommerce.feature (1 of 19) An error was thrown in your plugins file while executing the handler for the before:spec event.
The error we received was:
Error: Unexpected state in beforeSpecHandler: uninitialized. This almost always means that you or some other plugin, are overwriting this plugin's event handlers. For more information & workarounds, see https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/event-handlers.md (if neither workaround work, please report at https://github.com/badeball/cypress-cucumber-preprocessor) at createStateError (E:\Tutorials\actionSQA\Cypress\CypressFramework\node_modules@badeball\cypress-cucumber-preprocessor\dist\plugin-event-handlers.js:83:58) at beforeSpecHandler (E:\Tutorials\actionSQA\Cypress\CypressFramework\node_modules@badeball\cypress-cucumber-preprocessor\dist\plugin-event-handlers.js:265:19) PS E:\Tutorials\actionSQA\Cypress\CypressFramework>
I installed following packages and configuration:
in package.json:
"cypress-cucumber-preprocessor": { "json": { "enabled": true, "output": "cypress/cucumberReport/results.json" } }, "devDependencies": { "@badeball/cypress-cucumber-preprocessor": "^20.1.0", "@cypress/browserify-preprocessor": "^3.0.2", "cypress": "^13.12.0"} In cypress-config.js
const { defineConfig } = require("cypress"); const preprocessor = require("@badeball/cypress-cucumber-preprocessor"); const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
async function setupNodeEvents(on, config) {
await preprocessor.addCucumberPreprocessorPlugin(on, config); require('cypress-mochawesome-reporter/plugin')(on); on("file:preprocessor", browserify.default(config)); return config; }
module.exports = defineConfig({ e2e: { setupNodeEvents, specPattern: 'cypress/integration/examples/*/.{js,feature,ts,tsx}' } });