const axeCore = require('axe-core');
const assert = require('assert');
const axeHtmlReporter = require('axe-html-reporter');
const { createWriteStream } = require('fs/promises');
const { join } = require('path');
describe('Accessibility tests', () => { it('should pass accessibility test', async () => { // Navigate to the website await browser.url('https://www.orangehrm.com/');
// Inject axe-core into the page
const axeSource = axeCore.source;
await browser.execute(axeSource);
// Run axe-core on the page
const axeResults = await browser.executeAsync(function(axeCallback) {
axe.run(function(err, results) {
if (err) throw err;
axeCallback(results);
});
});
const reportPath = join(process.cwd(), 'accessibility_report.html');
console.log(reportPath);
const writable = createWriteStream(reportPath);
console.log(writable);
const readable = await axeHtmlReporter.processResults(axeResults);
console.log(readable);
readable.pipe(writable);
});
});
the html report is not being generated from the above code. I am trying to inject axe core into the page and get results and store the results in html report. but I am not able to get the html report generated.