kpmck / cypress-ag-grid

Cypress plugin for interacting with ag grid
30 stars 17 forks source link

Support returning headers, rows values as array #2

Closed manikantag closed 3 years ago

manikantag commented 3 years ago

When options.rawValues = true, returns the headers and rows values as an array instead of mapping each row as an object. This is useful when same header names are used in nested headers.

Ex grid:

image

Existing cy.get("grid-selector").getAgGridData() will result in below object for a row data, as same header names (Original, Upload, Difference) are used twice:

{
  Difference: "0.000"
  Feature Name: "Loan Amount"
  Original: "0.046"
  PSI: "0.000"
  Type: "Continuous"
  Upload: "0.046"
}

When we set rawValues = true, like cy.get("grid-selector").getAgGridData({valuesArray: true}), then it will result in headers and rows as arrays.

Ex:

cy.get("grid-selector")
  .getAgGridData({valuesArray: true})
  .then((headers, rows) => console.log(headers, rows)); // prints two array of values
kpmck commented 3 years ago

Thanks so much for contributing to this repository!

manikantag commented 3 years ago

Glad if it useful

kpmck commented 3 years ago

I realized your contribution was not yet deployed, and I apologize for that. I will be deploying a new version here shortly where you can see your changes in action.