Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the expected behaviour of helpers to calculate the totalFolders and totalFailedFoldersin the templates #434

Closed
1 task done
ragnarok66 opened this issue Apr 19, 2024 · 7 comments
Labels
state: awaiting-response Waiting the for the author to respond state: triaged This issue has been triaged

Comments

@ragnarok66
Copy link

Is There An Existing Issue

What Are You Seeing

Hi,

I am trying to use in my template the handlebar helpers 'totalFolders' and the 'totalFailedFolders' in order to see the data in the summary section.

The way I am using the helpers in my template is:

<h1 class="display-{{#gt stats.assertions.total 999 }}4{{else}}1{{/gt}}">{{totalFolders aggregations}}</h1>
<h1 class="display-{{#gt stats.assertions.total 999 }}4{{else}}1{{/gt}}">{{totalFailedFolders aggregations}}</h1>

For both of them it returns same error:

return aggregations.length;
                            ^
TypeError: Cannot read properties of undefined (reading 'length')

I wonder what I am doing wrong ? Any help about this is more then welcome.

Thank you in advance.

Steps To Reproduce The Issue

It can be generated with the command from "Full Newman Command Or Node Script" section.

The handlebar helpers totalFolders and totalFailedFolders must be used in the custom template.

In my custom template I only added the two lines in the summary section:

<h1 class="display-{{#gt stats.assertions.total 999 }}4{{else}}1{{/gt}}">{{totalFolders aggregations}}</h1>
<h1 class="display-{{#gt stats.assertions.total 999 }}4{{else}}1{{/gt}}">{{totalFailedFolders aggregations}}</h1>

Works with any collection where you pass the folder to be executed. The delay, custom title, browser title, logs, noSyntaxHighlighting and showGlobalData are not mandatory.

Full Newman Command Or Node Script

npx newman run sweet/collections/Sweet.postman_collection.json --folder "Verify the sweets" --delay-request 1000 --environment sweet/environments/QAB.postman_environment.json --insecure -r cli,htmlextra --reporter-htmlextra-template sweet/template/batman.hbs --reporter-htmlextra-export testArtifacts/sweet.html --reporter-htmlextra-title "Regression-Tests-sweets" --reporter-htmlextra-browserTitle "Sweet" --reporter-htmlextra-logs --reporter-htmlextra-noSyntaxHighlighting --reporter-htmlextra-showGlobalData

HTMLEXTRA Version

1.23.0

Newman Version

6.1.0

Additional Context

In the summary section I would like to show the number of the test cases, which in my cases are the executed sub-foders
image

In the image above I use in the template:

{{stats.iterations.total}}

which is not correct, because it is the iterations count.

In my structure each sub-folder is a scenario. I want to count those scenarios.

In the Total Requests section is visible:
image

@ragnarok66 ragnarok66 added state: needs-triage This issue needs to be triaged type: bug Something isn't working labels Apr 19, 2024
Copy link

Hey @ragnarok66: 👋 - Thanks for helping to make the reporter better by raising this ticket. I will take a look as soon as I can and get back to you. Cheers, Danny.

@DannyDainton
Copy link
Owner

Hey @ragnarok66,

Just to be clear here, this isn't actually an issue with the reporter and the general report output seen by everyone - This is an issue with your custom template which is outside of anything that I have created.

I don't actually use those helpers in my templates, there were added to the reporter for a specific users context:

#191

This was about 4 years, I didn't fully understand what the user was doing back then and I still don't know.

@DannyDainton DannyDainton added state: triaged This issue has been triaged state: awaiting-response Waiting the for the author to respond and removed type: bug Something isn't working state: needs-triage This issue needs to be triaged labels Apr 19, 2024
@DannyDainton DannyDainton changed the title The handlebar helpers to calculate the totalFolders and totalFailedFoldersin the templates are not working as expected What is the expected behaviour of helpers to calculate the totalFolders and totalFailedFoldersin the templates Apr 19, 2024
@ragnarok66
Copy link
Author

ragnarok66 commented Apr 19, 2024

Hey @DannyDainton thank you for the fast replay. You are correct, this is not an issue with the original template. I want to accomplish the same things as @DamienChenon. I need to show the total folders that were executed and the total failed folders.
I used his draft template, but cannot accomplish the same results. :(

@DannyDainton
Copy link
Owner

I can't say what they were trying to do at that point in time - I tried to run the same thing back then and I still wasn't quite understanding what those helpers were needed for.

There's not a great deal I can do here I'm afraid, I'm not going to spending time investigating those helpers and getting them running for a custom template. I just simply don't have time to do that.

@ragnarok66
Copy link
Author

ragnarok66 commented Apr 19, 2024

Closing the issue.
It is not an issue in the report.
Resolved my problem by following an old issue.

Old Issue Link - (url)](#191)

@ragnarok66
Copy link
Author

Not an issue

Copy link

github-actions bot commented Jun 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: awaiting-response Waiting the for the author to respond state: triaged This issue has been triaged
Projects
None yet
Development

No branches or pull requests

2 participants