cypress-ag-grid
cypress-ag-grid copied to clipboard
Question: Smoother comparison of Actual and Expected?
Really love this tool. One thought though, I find myself doing a lot of troubleshooting the difference between Actual and Expected when the contents of a table change (or verifying if it changed as we intended for some reason). Do you have control ofter this output in the browser console? If so, would it be possible to feed the two arrays of objects to a visual comparison tool, by a link or something in the console log? I'm using https://jsondiff.com but I'll be happy to know what others use.
Thanks, @carwei! Right now it's using general Chai assertions to do actual vs expected comparison. I would be open to PRs that investigate a smarter, clearer way to investigate! I am unsure which version you are using at this moment, but newer versions will print out the actual vs expected values for the grid in our output, which should make validation a tad bit easier.
When I have a moment, I'd be happy to look into how to make this a little easier to debug!
Thanks, @carwei! Right now it's using general Chai assertions to do actual vs expected comparison. I would be open to PRs that investigate a smarter, clearer way to investigate! I am unsure which version you are using at this moment, but newer versions will print out the actual vs expected values for the grid in our output, which should make validation a tad bit easier.
When I have a moment, I'd be happy to look into how to make this a little easier to debug!
I'm running version 1.30 so I have a console log output of the actual and expected values. It's just that the diff hunting can get a little bit tedious copy & pasting them into an external diff analyzer manually several times. Of course, cypress-ag-grid
already makes my job easier so this is just something that would remove the friction that comes with finding out the diffs at the cell/row level.
Example from the docs
cy.get("#myGrid")
.getAgGridData()
.then((actualTableData) => {
cy.get(agGridSelector).agGridValidateRowsExactOrder(actualTableData, expectedTableData);
});
Are you using Chai then instead of agGridValidateRowsExactOrder
, passing actualTableData
and expectedTableData
to a Chai assertion? If so, in which cases are you using agGridValidateRowsExactOrder
?
Under the hood, it’s Chai assertions being executed for each of the agGridValidateX
commands: https://github.com/kpmck/cypress-ag-grid/blob/master/src/agGrid/agGridValidations.js
Ok, good to know. As a next step, I think I'll look for an npm package to compare the diffs for me and highlight them in the console.