sridharbandi / Java-a11y

Accessibility Automated Testing with Java Selenium
https://sridharbandi.github.io/Java-a11y/
MIT License
12 stars 12 forks source link

Unable to generate report because of impact with null value #19

Closed oallauddin closed 1 year ago

oallauddin commented 1 year ago

Running into issue with converting the axe json to html report. It looks like axe allows impact to be null. https://github.com/dequelabs/axe-core/blob/a38e93ef589d65ee764b07c1d55c411acb3ebf87/axe.d.ts#L6 Html report can't be generated because template needs to be updated to handle the null value.

Here is the error

- Failed at: #assign criticals = array?filter(x ->...  [in template "axe/pagemetrics.ftl" at line 52, column 1]
- Reached through: #include "pagemetrics.ftl"  [in template "axe/page.ftl" at line 10, column 5]

    The following has evaluated to null or missing:
==> x.impact  [in template "axe/pagemetrics.ftl" at line 52, column 39]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??

Parsed one of the json files generated by axe for the values of impact.

jq '.violations[].impact' 0fbc72be-3f36-42df-99a6-60133c30204f.json 
"serious"
"minor"
jq '.incomplete[].impact' 0fbc72be-3f36-42df-99a6-60133c30204f.json 
"serious"
null
sridharbandi commented 1 year ago

Hi @oallauddin, thanks for your PR. your fix is part of the release 3.0.1