Build a report on the use or not use of the data-qa attributes in the code
npm install data-qa-reportdata-qa attribute reporting tool.
The idea is to allow the team to quickly highlight elements with data-qa attributes and those without. Where in the code
the items code can be found and ultimately where on your website or app the element can be found.
The output will be written to disk or if no input passed it will log to the console.
The report format is IFinalReport found in, types/index.ts, but see further below for an example JSON output.
data-qa attributes on the elements that match the given CSS Selectorsdata-qa-report --input ./test/code-to-report-on --output ./test/report-output --css-selector 'APP-LT-BUTTON'It will:
- Read all the html files within: test/code-to-report-on
- Output the JSON report to the folder: ./test/report-output
- It will report on elements: APP-LT-BUTTON
The output from the test file results in:
``json``
{
"filesReport": [
{
"ext": "html",
"absolutePath": "/mnt/linuxdrive/code/opensource/data-qa-report/test/code-to-report-on/login.page.html",
"relativePath": "/test/code-to-report-on/login.page.html",
"resultsWithDataQa": [
{
"dataQaValue": "login-form-submit",
"nodeName": "APP-LT-BUTTON",
"xpath": "ION-CONTENT > ION-GRID > ION-ROW > ION-COL > FORM > APP-LT-BUTTON.button-login"
},
{
"dataQaValue": "forgot-password-cancel-button",
"nodeName": "APP-LT-BUTTON",
"xpath": "ION-CONTENT > ION-GRID > ION-ROW > ION-COL > FORM > DIV > APP-LT-BUTTON"
},
{
"dataQaValue": "forgot-password-form-submit",
"nodeName": "APP-LT-BUTTON",
"xpath": "ION-CONTENT > ION-GRID > ION-ROW > ION-COL > FORM > DIV > APP-LT-BUTTON"
}
],
"resultsWithoutDataQa": [
{
"nodeName": "APP-LT-BUTTON",
"xpath": "ION-CONTENT > ION-GRID > ION-ROW > ION-COL > NG-CONTAINER > APP-LT-BUTTON.email-login-button"
}
]
}
],
"quantities": {
"withDataQa": 3,
"withoutDataQa": 1
},
"nodeNames": [
"APP-LT-BUTTON"
]
}