hdorgeval / testcafe-reporter-cucumber-json

TestCafe reporter to generate json in cucumber format
MIT License
19 stars 24 forks source link

Cucumber steps not in the report #13

Closed jpatel13 closed 4 years ago

jpatel13 commented 4 years ago

Hello,

Not sure if this is as designed or a bug but I don't see steps from the feature file in the report and if I check reports/feature it is empty.

My project folder structures is e2e-automation/features/support/page_objects/.js
e2e-automation/features/step_definitions/
.js e2e-automation/features/*. feature e2e-automation/reports/

I've created the report-generator.js in the root of the project (e2e-automation) with configuration specified in the documentation (update to point correct reports folder)

When I run my tests using the following command: node_modules/.bin/gherkin-testcafe chrome features/step_definitions/.js features/.feature --r eporter cucumber-json:reports/report.json --reporter-app-name='My App' --reporter-app-version='x.y.z'

The json gets written to the reports folder, but nothing gets written under the features folder.

When I run node report-generator.js after the test run I get the following error: TypeError: step.text.join is not a function at eval (lodash.templateSources[8]:228:21) at arrayEach (/Users/WhiteLabel/e2e-automation/node_modules/lodash/lodash.js:516:11) at Function.forEach (/Users/WhiteLabel/e2e-automation/node_modules/lodash/lodash.js:9342:14) at eval (lodash.templateSources[8]:78:4) at arrayEach (/Users/WhiteLabel/e2e-automation/node_modules/lodash/lodash.js:516:11) at Function.forEach (/Users/WhiteLabele2e-automation/node_modules/lodash/lodash.js:9342:14) at eval (lodash.templateSources[8]:10:4) at suite.features.forEach.feature (/Users/WhiteLabel/e2e-automation/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:519:73) at Array.forEach () at _createFeatureIndexPages (/Users/WhiteLabel/e2e-automation/node_modules/multiple-cucumber-html-reporter/lib/generate-report.js:500:18)

If you could please provide details on how to resolve this issue that would be great

AM1988 commented 4 years ago

Hello.

I had the same issue after the latest upgrade. Fixed by reverting to the version I used before: "testcafe-reporter-cucumber-json": "1.2.0" and "multiple-cucumber-html-reporter": "1.12.0".

Looks like the issue is caused by the latest version of multiple-cucumber-html-reporter. What I found is https://github.com/wswebcreation/multiple-cucumber-html-reporter/commit/e30f076e87edb7471244b5acf32db2da82bb66e7

template templates/components/scenarios.tmpl

was changed from

<% if (step.text) { %>
                    <div id="info<%= scenarioIndex %><%= stepIndex %>-text" class="scenario-step-collapse collapse">
                      <pre class=info><% try { %>
<%= JSON.stringify(step.text, undefined, 2) %>
<% } catch (error) { %>
<%= step.text %>
<% } %></pre>

to <pre class=info><%= step.text.join('<br>') %></pre>

and it fails in

((__t = ( step.text.join('<br>') )) == null ? '' : __t) + ^ TypeError: step.text.join is not a function because join is an array's method.

hdorgeval commented 4 years ago

Hi @jpatel13 and @AM1988 thank you very much for your feedback 👍 . Current workaround is to pin multiple-cucumber-html-reporter to 1.12.0 I do my best to fix this asap.

hdorgeval commented 4 years ago

@jpatel13 , @AM1988 : the issue has been solved in release v4.0.0. Could you give it a try and let me know if it works for you? You must also upgrade the multiple-cucumber-html-reporter package to its latest version (see the README)

AM1988 commented 4 years ago

Hi @hdorgeval. Did a quick check with "multiple-cucumber-html-reporter": "1.13.1" and
"testcafe-reporter-cucumber-json": "^4.0.0" and it works fine for me. Thank you!

jpatel13 commented 4 years ago

Fix works, thanks for the help ! @hdorgeval @AM1988