Configure cypress-cucumber-preprocessor with Cypress 10 in Angular

Viewed 3402

Cypress 10 was released just days ago with a ton of major breaking changes. As a first time Cypress user (migrating from Protractor with Cucumber), I was not aware of this. I'm trying to install Cypress with Cucumber, but all of the documentation (and perhaps the cypress-cucumber-preprocessor plugin itself) are all written/configured for Cypress 9.

Has anyone successfully configured or migrated cypress-cucumber-preprocessor for Cypress 10 in an Angular project and, if so, what are the steps?

2 Answers

There's an issue raised Update plugin to be compatible with Cypress 10 #722 which is ongoing and include Cypress team and Badeball.

My experience is the plugin migration is a problem, as per danbord

The features are detected by cypress but when running it I end up with a "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined"

but others claim to have it working, including far11ven who shares a repo here.

I'm using "cypress-cucumber-preprocessor": "^4.2.0"

which is quite an old version and comes from TheBrainFamily and is no longer listed in their repositories.


Now resolved

Under RC status, see 722#issuecomment-1153256645

You can go ahead with the default steps it asks for migration during Cypress 10 & versions above installation. However , among few folder/file name changes , 'integration' folder name gets changed to 'e2e' which would fail the test run if you are using cypress-cucumber-preprocessor / BDD setup in the framework.

Inorder to make it work, you can follow the below steps:

  • Go to node_modules under your project folder
  • And navigate to the path -> /node_modules/cypress-cucumber-preprocessor/lib/stepDefinitionPath.js
  • Amend the below line of code

Before Change: const relativePath = confStepDefinitions || cypress${path.sep}integration;

After Change: const relativePath = confStepDefinitions || cypress${path.sep}e2e;

e2e change

Once this is done, if you trigger your test, it should work successfully.

Note: There are other lib files which still has 'integration' folder path in it and you can change those if needed. I have just answered for the query here.

Related