You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run a cucumber feature file and I would like to capture a screenshot in the cucumber html report after each step of the test. I used a AfterStep hook as follows (I have also used After, Before and BeforeAll hooks all of which run fine):
E/launcher - Error: TypeError: cucumber_2.AfterStep is not a function
at Object.<anonymous> (SmokeTest\hooks\ScenarioHook.ts:64:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at SmokeTest\node_modules\cucumber\lib\cli\index.js:142:42
at Array.forEach (<anonymous>)
at Cli.getSupportCodeLibrary (SmokeTest\node_modules\cucumber\lib\cli\index.js:142:22)
at SmokeTest\node_modules\cucumber\lib\cli\index.js:169:41
at Generator.next (<anonymous>)
at asyncGeneratorStep (SmokeTest\node_modules\cucumber\lib\cli\index.js:44:103)
at _next (SmokeTest\node_modules\cucumber\lib\cli\index.js:46:194)
I tried to modify the node_modules/@types/cucumber/index.d.ts file and added the following there:
Also modified the node_modules/cucumber/dist/cucumber.js with the following entry:
var AfterStep = methods.AfterStep;
exports.AfterStep = AfterStep;
...
function () {
...
AfterStep: this.defineTestRunHook('afterTestRunHookDefinitions'),
...
}
However, I still face this error. I didn't have to do all these modifications while using BeforeAll, Before, After hooks. PS: cucumber version used 5.1.0, protractor 5.4.2, typescript 3.6.2
The text was updated successfully, but these errors were encountered:
Different languages have different support structures for the hooks. So bare this in mind.
It looks like your using CucumberJS. I believe that doesn't support AfterStep. But I'll let someone else confirm. That might be why it's giving you an error.
Hi @kalebhushan - we just merged support for BeforeStep and AfterStep via #1416 in the last couple of days, and it's not released yet but should be very shortly with 7.0.0.
I am trying to run a cucumber feature file and I would like to capture a screenshot in the cucumber html report after each step of the test. I used a AfterStep hook as follows (I have also used After, Before and BeforeAll hooks all of which run fine):
When I try to run my test, I get an error
I tried to modify the
node_modules/@types/cucumber/index.d.ts
file and added the following there:Also modified the
node_modules/cucumber/dist/cucumber.js
with the following entry:However, I still face this error. I didn't have to do all these modifications while using BeforeAll, Before, After hooks. PS: cucumber version used 5.1.0, protractor 5.4.2, typescript 3.6.2
The text was updated successfully, but these errors were encountered: