Closed adbacker closed 2 years ago
Hi there @adbacker, thank you for filing this, and I'm really glad this plugin has been useful for you! I will take a look at this issue shortly and will reply back ASAP.
Where it was failing was the assumption is the aria-colindex
attribute existed on the actual .ag-cell element. This is used to ensure that the column data and headers are properly aligned, and we have another aria-rowindex
used to ensure the data is captured in the exact order as it appears in the grid.
In your implementation, the aria-colindex
value was on a child element of .ag-cell
š± But easy enough fix! I've applied it in the below PR and will be cutting a new version with this fix momentarily. š
when attempting to parse an ag-grid formatted as attached, getAgGridData fails with "Cannot read properties of undefined (reading 'nodeValue') "
(attached is a sanitized/minimized example page from the app I'm testing)
node_modules/cypress-ag-grid/src/agGrid/agGridInteractions.js:14:1 12 | function sortElementsByAttributeValue(attribute) { 13 | return (a, b) => { 14 | const contentA = parseInt(a.attributes[attribute].nodeValue, 10).valueOf(); | ^ 15 | const contentB = parseInt(b.attributes[attribute].nodeValue, 10).valueOf(); 16 | return contentA < contentB ? -1 : contentA > contentB ? 1 : 0; 17 | };
With a null check at the start of sortElementsByAttributeValue the grid parses successfully.
I'm sure there's a better/more maintainable approach, but this is what I used to validate my hunch:
I wasn't able to trace back far enough to figure out root cause. My first suspicion would be the empty header in the first and second columns of the grid...
app.zip
(THANK YOU for creating this plugin ... I nearly wept with joy when finding it. It saved me I-don't-know-how-much work to implement something similar that wouldn't have worked as well. :)