equal-access icon indicating copy to clipboard operation
equal-access copied to clipboard

Karma reporting framework contains an non-functioning API (unable to write JSON result to file)

Open devanshah2 opened this issue 7 years ago • 1 comments

Currently there exists an issues open in the open source karma tool where we are not able to send object from client side to server side: https://github.com/karma-runner/karma/issues/2192

Currently they have no plan to fix the issues, until there are more votes on the open source karma issues.

Therefore I am implementing a way for people to still be able to write the results to JSON from karma so that they can generate baselines files for their scans.

devanshah2 avatar Mar 16 '17 02:03 devanshah2

The way the work around works is, by simply calling the following: Focus on the block "REFER TO THIS PART"

                    // Perform the accessibility scan using the IBMaScan Wrapper
                    AAT.getCompliance(unitTestFile, unitTestFileKey, function (results) {

                        var returnCode = AAT.assertCompliance(results);
                         
                        // REFER TO THIS PART
                        // For the workaround need to make the testcase fail so that the results are sent to the server side and there is a parse that reads the string and converts it into JSON and writes it to file
                        expect(returnCode).toBe(0, JSON.stringify(results));

                        // Mark the testcases as done.
                        done();
                    });

Before making use of this workaround make sure you are using either frameworks jasmine or mocha and set color: false in karma config

        // enable / disable colors in the output (reporters and logs)
        colors: false,

Also make sure to only use the default karma reporter progress with AAT

reporters: ['progress', 'AAT']

devanshah2 avatar Mar 21 '17 15:03 devanshah2