protractor-beautiful-reporter icon indicating copy to clipboard operation
protractor-beautiful-reporter copied to clipboard

HTML Reporter not working

Open samends opened this issue 5 years ago • 7 comments

When I try opening the html reporter after my test script I get the following:

protractor-report-error On chrome error messages are the following:

Uncaught SyntaxError: Invalid or unexpected token
angular.min.js:43 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.7.2/$injector/modulerr?p0=reportingApp&p1=Error%3A%20%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.7.2%2F%24injector%2Fnomod%3Fp0%3DreportingApp%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A7%3A168%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A26%3A453%0A%20%20%20%20at%20b%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A25%3A477)%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A26%3A227%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A42%3A460%0A%20%20%20%20at%20q%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A8%3A76)%0A%20%20%20%20at%20g%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A42%3A308)%0A%20%20%20%20at%20hb%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A46%3A401)%0A%20%20%20%20at%20c%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A22%3A57)%0A%20%20%20%20at%20Vc%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fgdusnm%2Fprojects%2Fdata-dynamics%2Fsrc%2Fmain%2Fangular%2Freports%2Fscreenshots%2Fassets%2Fangular.min.js%3A22%3A370)
    at angular.min.js:7
    at angular.min.js:43
    at q (angular.min.js:8)
    at g (angular.min.js:42)
    at hb (angular.min.js:46)
    at c (angular.min.js:22)
    at Vc (angular.min.js:22)
    at ye (angular.min.js:21)
    at angular.min.js:340
    at HTMLDocument.b (angular.min.js:38)

I'm using the following version for my environment:

  • Chrome Version 79.0.3945.88
  • Windows 10
  • Node version v10.15.3
  • Protractor beautiful reporter 1.3.3
  • Protractor version 5.4.1

My onPrepare function is the following:

	onPrepare: function() {
		/*** Typescript compiler settings ***/
		require('ts-node').register({
			project: 'test/tsconfig.e2e.json'
		});
		jasmine.getEnv().addReporter(new HtmlReporter({
			baseDirectory: 'reports',
			screenshotsSubfolder: 'screenshots'
		 }).getJasmine2Reporter());
	}

The screenshots and json output just fine.

samends avatar Jan 09 '20 20:01 samends

You have to use jasmine 2;

You can do by adding the below property to config file:

framework: 'jasmine'

Final looks like:

exports.config = {
  // Specify you want to use jasmine 2.x as you would with mocha. Note, 'jasmine' by default will use the latest jasmine framework.
  framework: 'jasmine',

onPrepare:{
//yourcode
}
};

praveendvd avatar Jan 29 '20 16:01 praveendvd

Hello, we got exactly same problem even we are using same configuration Jasmine 2.x. I think this issue happens when test report contains large number of tests (in our case >600 test specs) and when these values inserted to the html report this Json for some reasons is cut (maybe limitations in buffer size):

Our config:

jasmine.getEnv().addReporter(new HtmlReporter({
  baseDirectory: 'e2e/coverage',
  screenshotsSubfolder: 'screenshots',
  jsonsSubfolder: 'jsons',
 docName: 'index.html',
 preserveDirectory: false
}).getJasmine2Reporter());

Screenshots:

image

image

When number of tests less then ~600 report works fine.

Can you please suggest possible workaround/fixes that can be done in this case? Didn't find any suitable config parameters in the documentation.

dioniseo avatar Feb 13 '20 09:02 dioniseo

@samenz @Denis220795 can you please inspect the combined.json file? Is it also corrupt?

miller45 avatar Feb 14 '20 09:02 miller45

@miller45 , I'm trying to make more testing now. Seems like there are some issues with one of our test suite that uses special characters like $ signs etc and reporter cannot parse it correctly, as a result Json file become corrupted. Will provide you the results soon.

dioniseo avatar Feb 14 '20 09:02 dioniseo

@Denis220795 In that case ($ signs) you could use a method described here: https://github.com/Evilweed/protractor-beautiful-reporter/wiki/Parsing-spec-tags-into-metadata to filter outer toxic characters...we are using that method in my company also...

miller45 avatar Feb 14 '20 10:02 miller45

@miller45 , yes the issue was related to one of the tests that uses some special characters (not sure what exactly). After skipping this test report was generated correctly. We will try to debug it and check what exactly happened there that failed rendering of the report. Thanks for the info I'll take a look at this link.

dioniseo avatar Feb 14 '20 11:02 dioniseo

This is the same problem as I have in #140.

OldShaterhan avatar Feb 26 '20 19:02 OldShaterhan