lpelypenko / axe-html-reporter

Creates easy to read HTML file from axe-core® accessibility results object
MIT License
30 stars 22 forks source link

axe-html-reporter does not create the report #16

Closed michael-visco closed 1 year ago

michael-visco commented 3 years ago

I have integrated the axe-html-reporter with cypress-axe. When I call createHtmlReport I give it the violations array that is returned by the axe tests which looks the same as the examples provided in your repo. The createHtmlReport function does not return any errors or give any information on why it cannot create the report.

michael-visco commented 3 years ago

createHtmlReport({ results: { violations: violations }, options: { outputDir: 'reports/tests/axe/logs', reportFileName: 'violationsLog.html', }, }) Here is how I am calling the reporter with the violations array.

lpelypenko commented 3 years ago

Hi @michael-visco, I am sorry, I don't have much experience with cypress and cypress-axe and can't help with troubleshooting.

glafirazhur commented 2 years ago

Hi @michael-visco and @lpelypenko!

I'm definiteley not familiar with Cypress and with Node.js but I've researched a bit and finally understood that this (cool) tool is creating a file (obviously) and this task could be done at the "server" Node.js side only, so for me, the way to create it by task in the CY plugins/index.js folder works fine :)

I create a custom task putting there parameters I need (violations and all the other stuff for the report like test case name) and call the createHTMLReport there.

afterTest(args) {
    createHtmlReport({
        results: { violations: args.violations },
        options: {
            customSummary,
            outputDir: 'axe-reports',
            reportFileName: 'reportName.html',
        }
    });
    return null;
}

Then I call this task in the Cypress checkAlly violationsCallback .

function violationCallback(violations) {
    //args definition
    cy.task('afterTest', args,{ log: false });
}

Hope this will help :)