DannyDainton / newman-reporter-htmlextra

A HTML reporter for Postman's Command Line Runner, Newman. Includes Non Aggregated Runs broken down by Iterations, Skipped Tests, Console Logs and the handlebars helpers module for better custom templates.
Apache License 2.0
356 stars 139 forks source link

[Bug] The final reports are slow to render #428

Open canle1404 opened 8 months ago

canle1404 commented 8 months ago

Is There An Existing Issue

What Are You Seeing

image

I understand that the size of the HTML report file is larger when using 'newman-reporter-html'. In order to improve its load time, I push it to S3 with Cloudfront. While this method does make it faster, it takes a long time to render (I'm not exactly sure what the correct term is) which causes my browser to slow down for about 1-2 minutes.

Steps To Reproduce The Issue

Generate with the below script

Full Newman Command Or Node Script

newman run \
            postman_collection.json \
            --environment postman_environment.json \
            --reporters htmlextra \
            --reporter-htmlextra-export "$REPORT_FILE" \
            --reporter-htmlextra-noSyntaxHightlighting \
            --suppress-exit-code

HTMLEXTRA Version

1.23.0

Newman Version

6.1.0

Additional Context

No response

github-actions[bot] commented 8 months ago

Hey @canle1404: 👋 - 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 commented 7 months ago

Hey, @canle1404,

Apologies for the tarde response here - It's been a busy time.

This is an ongoing issue , one that's been reported a few times. I haven't made any huge changes to speed this up. There are a number of flags that you can use to reduce the amount of information that's part of the final report.

Do you need all the information for every single request, who is the report for? Do they need to see everything?

There isn't really anything that i'm going to be doing here in the short term, you can leave this issue open for tracking purposes if you'd like to see any progress made in the future though.

canle1404 commented 7 months ago

Thank you @DannyDainton

thetilliwilli commented 7 months ago

sharing workarounds:

  1. first problem is syntax hightlighting 1.1 solution: use noSyntaxHightlighting flag
  2. second problem is function formatXML and the RegEx parsing is to slow on big-lengthed rows image 2.1 solution (aka hack) - rewriting final report before publishing to users: image 2.2
    const rewrittenContent = inFileContent.replace(
        `return xml.split('\\r\\n').map((node, index) => {`,
        `return xml.length > 10000 ? xml : xml.split('\\r\\n').map((node, index) => {`
      );
      fs.writeFileSync(outFilePath, rewrittenContent);