-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* changed licences to set to false so key shows even when no license, added another commented out service * cleaning up to refactor out processsing * ectracted report generating and report processing out of index.js * cleaned formatting of queries in api readme
- Loading branch information
1 parent
a291617
commit 4f8d81f
Showing
5 changed files
with
135 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
// processAxeReport.js | ||
import { evaluateAccessibility } from './accessibility-checks.js' | ||
|
||
export function processAxeReport(axeReport, pageToEvaluate) { | ||
const webEndpointAxeResults = {}; | ||
|
||
export async function processAxeReport(pageInstance, pages, browser) { | ||
let webEndpointAxeResults = {} //form response | ||
|
||
for (const pageToEvaluate of pages) { | ||
console.log('Evaluating page: ', pageToEvaluate) | ||
const axeReport = await evaluateAccessibility(pageToEvaluate, pageInstance, browser) | ||
|
||
// Process report (create camelCase key for each evaluated criterion ) | ||
for (let i = 0; i < axeReport.length; i++) { | ||
const camelize = s => s.replace(/-./g, x => x[1].toUpperCase()) | ||
const criterion = axeReport[i]; | ||
const criterionKey = Object.keys(criterion )[0]; | ||
const criterionValue = criterion [criterionKey]; | ||
const criterionKeyCamelCase = camelize(criterionKey); | ||
if (!webEndpointAxeResults[pageToEvaluate]) { | ||
webEndpointAxeResults[pageToEvaluate] = {} | ||
} | ||
if (typeof criterionValue.checkPasses === 'boolean') { | ||
criterionValue.checkPasses = criterionValue.checkPasses.toString() | ||
} | ||
webEndpointAxeResults[pageToEvaluate][criterionKeyCamelCase] = { | ||
checkPasses: criterionValue.checkPasses, | ||
metadata: criterionValue.metadata, | ||
} | ||
const camelize = s => s.replace(/-./g, x => x[1].toUpperCase()) | ||
const criterion = axeReport[i]; | ||
const criterionKey = Object.keys(criterion )[0]; | ||
const criterionValue = criterion [criterionKey]; | ||
const criterionKeyCamelCase = camelize(criterionKey); | ||
if (!webEndpointAxeResults[pageToEvaluate]) { | ||
webEndpointAxeResults[pageToEvaluate] = {} | ||
} | ||
if (typeof criterionValue.checkPasses === 'boolean') { | ||
criterionValue.checkPasses = criterionValue.checkPasses.toString() | ||
} | ||
webEndpointAxeResults[pageToEvaluate][criterionKeyCamelCase] = { | ||
checkPasses: criterionValue.checkPasses, | ||
metadata: criterionValue.metadata, | ||
} | ||
} | ||
|
||
return Object.keys(webEndpointAxeResults).map(page => ({ | ||
} | ||
const accessibilityPages = Object.keys(webEndpointAxeResults).map(page => { | ||
return { | ||
url: page, | ||
...webEndpointAxeResults[page], | ||
})); | ||
} | ||
|
||
} | ||
}) | ||
return accessibilityPages | ||
} |