Catch AXE errors (#2831)
This commit is contained in:
parent
5ca4c272f4
commit
98cf62d4a8
|
|
@ -7,15 +7,23 @@ module.exports = async function(context) {
|
|||
// Only configure if we have more keys thhan axe.enable
|
||||
if (context.options.axe && Object.keys(context.options.axe).length > 1) {
|
||||
await context.selenium.driver.executeScript(
|
||||
'axe.configure(' + JSON.stringify(context.options.axe) + ');'
|
||||
'axe.configure(' + JSON.stringify(context.options.axe) + ');',
|
||||
'CONFIGURE_AXE'
|
||||
);
|
||||
}
|
||||
|
||||
// Get the result from axe
|
||||
const result = await context.selenium.driver.executeAsyncScript(
|
||||
'window.axe.run().then(arguments[arguments.length - 1]);'
|
||||
);
|
||||
|
||||
// Use the extras field in Browsertime and pass on the result
|
||||
context.result[context.result.length - 1].extras.axe = result;
|
||||
try {
|
||||
const result = await context.selenium.driver.executeAsyncScript(
|
||||
'window.axe.run().then(arguments[arguments.length - 1]);',
|
||||
'RUNNING_AXE'
|
||||
);
|
||||
// Use the extras field in Browsertime and pass on the result
|
||||
context.result[context.result.length - 1].extras.axe = result;
|
||||
} catch (e) {
|
||||
context.log.error(
|
||||
'Could not run the AXE script, no AXE information collected',
|
||||
e
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue