Importing Siteimprove alfa generated EARL to WAI WCAG-EM Report tool fails #990
-
I am trying to import EARL JSON-LD generated by Siteimprove alfa into WAI WCAG-EM report tool (https://github.com/w3c/wai-wcag-em-report-tool) but get an error and import fails. After some debugging I discovered that Json file is missing the subject to pass the first parsing; Before I do any changes to Siteimprove EARL generator I have to ask if there are any plans for synchronization of it or am I maybe forgetting something when exporting results to EARL using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Thanks for spotting this. I'll look into it. |
Beta Was this translation helpful? Give feedback.
-
Looking more into it, it seems the subject has to be added manually. When I'm calling the CLI on one of ACT rules examples ( {
"@context": {
"earl": "http://www.w3.org/ns/earl#"
},
"@type": "earl:Assertion",
"earl:test": {
"@id": "https://alfa.siteimprove.com/rules/sia-r16"
},
"earl:result": {
"@type": "earl:TestResult",
"earl:outcome": {
"@id": "earl:passed"
},
"earl:info": "The element has all required states and properties",
"earl:pointer": {
"@context": {
"ptr": "http://www.w3.org/2009/pointers#"
},
"@type": [
"ptr:Pointer",
"ptr:SinglePointer",
"ptr:ExpressionPointer",
"ptr:XPathPointer"
],
"ptr:expression": "/html[1]/body[1]/div[1]"
}
},
"earl:assertedBy": {
"@id": "https://alfa.siteimprove.com/"
},
"earl:subject": {
"@id": "https://act-rules.github.io/testcases/ff89c9/39c0a2b75b4795e2e3ebb46520c926c6e01c90bd.html"
}
} Which contains the correct The relevant bit for adding the subject is done by the EARL formatter: alfa/packages/alfa-formatter-earl/src/earl.ts Lines 57 to 59 in db3bbff which is called from the CLI command: You probably want to mimic that in your own script to correctly fill the |
Beta Was this translation helpful? Give feedback.
Looking more into it, it seems the subject has to be added manually.
The reason is that the individual outcomes (or rules) don't really know about the test subject, only the full audit knows the test subject (the page).
When I'm calling the CLI on one of ACT rules examples (
node .\packages\alfa-cli\bin\alfa audit -f earl -o report.json --outcome passed https://act-rules.github.io/testcases/ff89c9/39c0a2b75b4795e2e3ebb46520c926c6e01c90bd.html
), I get the following EARL bit: