cypress-ag-grid 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,376 +1,378 @@
1
- # cypress-ag-grid
2
- Cypress plugin for interacting with and validating against ag grid.
3
-
4
- ## Table of Contents
5
- * [Installation](#installation)
6
- * [Usage](#usage)
7
- + [Grid Interaction](#)
8
- - [Getting Data From the Grid](#getting-data-from-the-grid)
9
- - [Getting Select Row Data](#getting-select-row-data)
10
- - [Getting Elements From the Grid](#getting-elements-from-the-grid)
11
- - [Sorting Columns](#sorting-columns)
12
- + [Grid Filtering](#)
13
- - [Filter Options](#filter-options)
14
- - [Filter by Text - Column Menu](#filter-by-text---column-menu)
15
- - [Filterby Text - Floating Filter](#filterby-text---floating-filter)
16
- - [Filter by Checkbox - Column Menu](#filter-by-checkbox---column-menu)
17
- - [Filtering - Localization and Internationalization](#filtering---localization-and-internationalization)
18
- - [Add or Remove Columns](#add-or-remove-columns)
19
- + [Grid Validation](#)
20
- - [Validate Paginated Table](#validate-paginated-table)
21
- - [Validate Table in the Exact Order](#validate-table-in-the-exact-order)
22
- - [Validate Subset of Table Data](#validate-subset-of-table-data)
23
- - [Validate Empty Grid](#validate-empty-grid)
24
- * [Limitations](#limitations)
25
- * [Credit](#credit)
26
- <br/>
27
- <br/>
28
-
29
- ## Installation
30
-
31
- ```bash
32
- npm install cypress-ag-grid --save-dev
33
- ```
34
- Then include the following in your support/index.js file:
35
-
36
- ```javascript
37
- import "cypress-ag-grid";
38
- ```
39
- ## Usage
40
- Consider the ag grid example below:
41
- ![alt text](./ag-grid-example.png "AG Grid")
42
-
43
- With the following DOM structure:
44
- ![alt text](./ag-grid-example-dom.png "AG Grid Dom")
45
- <br/>
46
- <br/>
47
- ### Getting Data From the Grid:
48
- To get the Ag Grid data, you must chain `.getAgGridData()` after the `cy.get()` command for the topmost level of the grid, including controls and headers (see selected DOM element in above image).
49
-
50
- Correct Usage:
51
- ```javascript
52
- cy.get("#myGrid").getAgGridData()
53
- ```
54
-
55
- Incorrect Usage:
56
- ```javascript
57
- cy.getAgGridData();
58
- ```
59
-
60
- The correct command will return the following:
61
- ```json
62
- [
63
- { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
64
- { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
65
- { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
66
- { "Year": "2020", "Make": "BMW", "Model": "3-series" },
67
- { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
68
- ]
69
- ```
70
- </br>
71
- </br>
72
-
73
- ### Getting Select Row Data
74
- To only get certain rows of data, pass the header values into the `getAgGridData()` command, like so:
75
-
76
- ```javascript
77
- cy.get("#myGrid").getAgGridData({ onlyColumns: ["Year", "Make"] })
78
- ```
79
-
80
- The above command will return the follwoing:
81
- ```json
82
- [
83
- { "Year": "2020", "Make": "Toyota"},
84
- { "Year": "2020", "Make": "Ford"},
85
- { "Year": "2020", "Make": "Porsche"},
86
- { "Year": "2020", "Make": "BMW"},
87
- { "Year": "2020", "Make": "Mercedes"},
88
- ]
89
- ```
90
- </br>
91
- </br>
92
-
93
- ### Getting Elements From the Grid
94
- To get the Ag Grid data as elements (if you want to interact with the cells themselves), you must chain `.getAgGridElements()` after the `cy.get()` command for the topmost level of the grid, including controls and headers (see selected DOM element in above image).
95
- ```javascript
96
- cy.get(agGridSelector)
97
- .getAgGridElements()
98
- .then((tableElements) => {
99
- const porscheRow = tableElements.find(
100
- (row) => row.Price.innerText === "72000"
101
- );
102
- const priceCell = porscheRow.Price;
103
- cy.wrap(priceCell).dblclick().type("66000{enter}");
104
- });
105
-
106
- ```
107
-
108
- The above example will grab the table as elements, finds the row whose `Price` equals `72000`. It then gets the `Price` cell for that row, double clicks on it to enable an editable input, and changes the value of the cell.
109
- </br>
110
- </br>
111
-
112
- ### Sorting Columns
113
- This command will sort the specified column by the sort direction specified.
114
-
115
- <b>Defintion</b>:
116
- `.agGridSortColumn(columnName:String, sortDirection:String)`
117
-
118
- Example:
119
-
120
- ```javascript
121
- cy.get("#myGrid").agGridSortColumn("Model", "descending");
122
- ```
123
- </br>
124
- </br>
125
-
126
- ### Filter Options
127
-
128
- The below filtering commands takes an `options` parameter comprised of the following properties:
129
-
130
- ```javascript
131
- options: {
132
- searchCriteria: [{
133
- columnName: string;
134
- filterValue: string;
135
- operator?: string;
136
- }];
137
- hasApplyButton?: boolean;
138
- noMenuTab?: boolean;
139
- selectAllLocaleText: string;
140
- }
141
-
142
- /**
143
- - options.searchCriteria JSON with search properties and options
144
- - options.searchCriteria.columnName name of the column to filter
145
- - options.searchCriteria.filterValue value to input into the filter textbox
146
- - options.searchCriteria.searchInputIndex [Optional] Uses 0 by default. Index of which filter box to use in event of having multiple search conditionals
147
- - options.searchCriteria.operator [Optional] Use if using a search operator (i.e. Less Than, Equals, etc...use filterOperator.enum values).
148
- - options.hasApplyButton [Optional] True if "Apply" button is used, false if filters by text input automatically.
149
- - options.noMenuTabs [Optional] True if you use, for example, the community edition of ag-grid, which has no menu tabs
150
- - options.selectAllLocaleText [Optional] Pass in the locale text value of "Select All" for when you are filtering by checkbox - this wil first deselect the "Select All" option before selecting your filter value
151
- */
152
- ```
153
-
154
- ### Filter by Text - Column Menu
155
- This command will filter a column by a text value from its menu. In the options, you must specify a `searchCriteria` objects containing one or more objects with `columnName`, `filterValue`, and optionally `operator` (i.e. Contains, Not contains, Equals, etc.).
156
-
157
- ![alt text](./ag-grid-example-filter-text-menu.png "AG Grid Dom - Filter by Text Menu")
158
-
159
- <b>Definition:</b> `.agGridColumnFilterTextMenu(options: {})`
160
-
161
- Example:
162
- ```javascript
163
- cy.get("#myGrid").agGridColumnFilterTextMenu({
164
- searchCriteria:[{
165
- columnName: "Model",
166
- filterValue: "GLC300",
167
- operator:"Equals"
168
- },
169
- {
170
- columnName: "Make",
171
- filterValue: "Mercedes",
172
- operator:"Equals"
173
- }
174
- ],
175
- hasApplyButton: false
176
- })
177
- ````
178
- The above command will filter the Model column for the value 'GLC300' and set the filter operator to 'Equals'. It will then apply a secondary filter on the Make column for 'Mercedes'.
179
- </br>
180
- </br>
181
- ### Filterby Text - Floating Filter
182
- This command will filter a column by a text value from its floating filter (if applicable). This command will filter a column by a text value from its floating menu. In the options, you must specify a `searchCriteria` object with `columnName`, `filterValue`, and optionally `operator` (i.e. Contains, Not contains, Equals, etc.) and `searchInputIndex` in the event you wish to apply multiple text conditions (see below for multi-condition example).
183
-
184
- ![alt text](./ag-grid-example-filter-text-floating.png "AG Grid Dom - Filter by Text Floating")
185
-
186
- <b>Definition:</b> .agGridColumnFilterTextFloating(options: {})
187
-
188
- Example:
189
- ```
190
- cy.get(agGridSelector).agGridColumnFilterTextFloating({
191
- searchCriteria: {
192
- columnName: "Make",
193
- filterValue: "Ford",
194
- },
195
- hasApplyButton: true,
196
- });
197
- ```
198
-
199
- The above example will search for the Make `Ford` from the floating text menu filter.
200
-
201
- If you have the option for multiple conditions on the floating filter, you can do two searches, specifying the `searchInputIndex` parameter in the `searchCriteria` object. The below example will ssarch for any `Make` that contains `B` AND `MW`:
202
-
203
- Example:
204
- ```
205
- cy.get(agGridSelector).agGridColumnFilterTextFloating({
206
- searchCriteria: {
207
- columnName: "Make",
208
- filterValue: "B",
209
- searchInputIndex: 0,
210
- },
211
- hasApplyButton: true,
212
- });
213
- cy.get(agGridSelector).agGridColumnFilterTextFloating({
214
- searchCriteria: {
215
- columnName: "Make",
216
- filterValue: "MW",
217
- searchInputIndex: 1,
218
- },
219
- hasApplyButton: true,
220
- });
221
- ```
222
- ![alt text](./ag-grid-example-filter-text-floating-multi-condition.png "AG Grid Dom - Filter by Text Floating")
223
-
224
- <br/>
225
- </br>
226
-
227
- ### Filter by Checkbox - Column Menu
228
- This command will filter a column by a checkbox text value from its menu.
229
- ![alt text](./ag-grid-example-filter-checkbox-menu.png "AG Grid Dom - Filter by Checkbox Menu")
230
-
231
- Definition:
232
- ```javascript
233
- .agGridColumnFilterCheckboxMenu(options={})
234
- ```
235
-
236
- Example:
237
- ```javascript
238
- cy.get("#myGrid").agGridColumnFilterCheckboxMenu({
239
- searchCriteria: {
240
- columnName: "Model",
241
- filterValue: "2002",
242
- },
243
- hasApplyButton: true,
244
- });
245
-
246
- ```
247
- </br>
248
-
249
- ### Filtering - Localization and Internationalization
250
- When we filter by checkbox, we first deselect the Select All checkbox to ensure we ONLY select the specified checkbox. Since AG grid allows for localization, we need a way to be able to pass in the localeText for Select All. This is the only area of this plugin that has a hard-coded value, so no other localization accommodations are needed.
251
-
252
- ```
253
- cy.get("#myGrid").agGridColumnFilterCheckboxMenu({
254
- searchCriteria: {
255
- columnName: "Model",
256
- filterValue: "2002",
257
- },
258
- selectAllLocaleText: "Tout Sélectionner"
259
- hasApplyButton: true,
260
- });
261
- ```
262
- </br>
263
-
264
- ### Add or Remove Columns
265
- This command will toggle the specified column from the grid's sidebar.
266
-
267
- <b>Definition:</b>`.agGridToggleColumnsSideBar(columnName:String, doRemove:boolean)`
268
-
269
- Example:
270
- ```javascript
271
- // This will remove the column "Year" from the grid
272
- cy.get("#myGrid").agGridToggleColumnsSideBar("Year", true);
273
- ```
274
- <br/>
275
- <br/>
276
-
277
- ### Validate Paginated Table
278
- This command will validate the paginated grid's data. The supplied expectedPaginatedTableData must be paginated as it's shown in the grid.
279
-
280
- <b>Definition:</b> `agGridValidatePaginatedTable(expectedPaginatedTableData, onlyColumns = {})`
281
-
282
- Example:
283
- ```javascript
284
- const expectedPaginatedTableData = [
285
- [
286
- { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
287
- { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
288
- { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
289
- { "Year": "2020", "Make": "BMW", "Model": "3-series" },
290
- { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
291
- ],
292
- [
293
- { "Year": "2020", "Make": "Honda", "Model": "Civic" },
294
- { "Year": "2020", "Make": "Honda", "Model": "Accord" },
295
- { "Year": "2020", "Make": "Ford", "Model": "Taurus" },
296
- { "Year": "2020", "Make": "Hyundai", "Model": "Elantra" },
297
- { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
298
- ],
299
- ...other table data
300
- ];
301
- cy.get("#myGrid").agGridValidatePaginatedTable(
302
- expectedPaginatedTableData, onlyColumns ={"Year", "Make", "Model"}
303
- );
304
- });
305
- ```
306
- <br/>
307
- <br/>
308
-
309
- ### Validate Table in the Exact Order
310
- This command will verify the table data is displayed exactly in the same order as the supplied expected table data. This will ONLY validate the first page of a paginated table.
311
-
312
- <b>Definition</b>: `.agGridValidateRowsExactOrder(actualTableData, expectedTableData)`
313
-
314
- Example:
315
- ```javascript
316
- cy.get("#myGrid")
317
- .getAgGridData()
318
- .then((actualTableData) => {
319
- cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
320
- });
321
- ```
322
- <br/>
323
- <br/>
324
-
325
- ### Validate Subset of Table Data
326
- This command will validate a subset of the table data. Ideal for verifying one or more records, or verify records without specified columns.
327
-
328
- <b>Definition:</b>: `agGridValidateRowsSubset(actualTableData, expectedTableData)`
329
-
330
- Example:
331
- ```javascript
332
- const expectedTableData = [
333
- { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
334
- { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
335
- { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
336
- { "Year": "2020", "Make": "BMW", "Model": "3-series" },
337
- { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
338
- ];
339
- cy.get(agGridSelector)
340
- .getAgGridData({ onlyColumns: ["Year", "Make", "Model"] })
341
- .then((actualTableData) => {
342
- cy.agGridValidateRowsSubset(actualTableData, expectedTableData);
343
- });
344
- });
345
- ```
346
- <br/>
347
- <br/>
348
-
349
- ### Validate Empty Grid
350
- This will verify the table data is empty.
351
-
352
- <b>Definition</b>:`agGridValidateEmptyTable(actualTableData, expectedTableData)`
353
-
354
- Example:
355
- ```javascript
356
- cy.get(agGridSelector)
357
- .getAgGridData()
358
- .then((actualTableData) => {
359
- cy.agGridValidateEmptyTable(actualTableData);
360
- });
361
- ```
362
-
363
- ## Limitations
364
- * ~~Unable to validate deeply nested row groups~~ As of v2.x, using `.getAgGridElements()` you should be able to accomplish this.
365
- * ~~Unable to validate deeply nested column groups~~ As of v2.x, using `.getAgGridElements()` you should be able to accomplish this.
366
- * Unable to validate the entirety of an unlimited scrolling grid.
367
- * Unable to validate data that is out of view. The DOM will register the ag grid data as it's scrolled into view.
368
- * To combat this, in your code where the ag grid is called, check if the Cypress window is controlling the app and set the ag grid object to `.sizeColumnsToFit()`. You can see an example of this in the `app/grid.js` file of this repository. Read more [here](https://www.ag-grid.com/javascript-grid/column-sizing/#size-columns-to-fit)
369
- * Example:
370
- ```javascript
371
- if(window.Cypress){
372
- this.api.sizeColumnsToFit();
373
- }
374
- ```
375
- ## Credit
376
- A portion of the logic to retrieve table data was expanded upon from the project [Cypress-Get-Table](https://github.com/roggerfe/cypress-get-table) by [Rogger Fernandez](https://github.com/roggerfe).
1
+ # cypress-ag-grid
2
+ Cypress plugin for interacting with and validating against ag grid.
3
+
4
+ ## Table of Contents
5
+ * [Installation](#installation)
6
+ * [Usage](#usage)
7
+ + [Grid Interaction](#)
8
+ - [Getting Data From the Grid](#getting-data-from-the-grid)
9
+ - [Getting Select Row Data](#getting-select-row-data)
10
+ - [Getting Elements From the Grid](#getting-elements-from-the-grid)
11
+ - [Sorting Columns](#sorting-columns)
12
+ + [Grid Filtering](#)
13
+ - [Filter Options](#filter-options)
14
+ - [Filter by Text - Column Menu](#filter-by-text---column-menu)
15
+ - [Filterby Text - Floating Filter](#filterby-text---floating-filter)
16
+ - [Filter by Checkbox - Column Menu](#filter-by-checkbox---column-menu)
17
+ - [Filtering - Localization and Internationalization](#filtering---localization-and-internationalization)
18
+ - [Add or Remove Columns](#add-or-remove-columns)
19
+ + [Grid Validation](#)
20
+ - [Validate Paginated Table](#validate-paginated-table)
21
+ - [Validate Table in the Exact Order](#validate-table-in-the-exact-order)
22
+ - [Validate Subset of Table Data](#validate-subset-of-table-data)
23
+ - [Validate Empty Grid](#validate-empty-grid)
24
+ * [Limitations](#limitations)
25
+ * [Credit](#credit)
26
+ <br/>
27
+ <br/>
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install cypress-ag-grid --save-dev
33
+ ```
34
+ Then include the following in your support/index.js file:
35
+
36
+ ```javascript
37
+ import "cypress-ag-grid";
38
+ ```
39
+ ## Usage
40
+ Consider the ag grid example below:
41
+ ![alt text](./ag-grid-example.png "AG Grid")
42
+
43
+ With the following DOM structure:
44
+ ![alt text](./ag-grid-example-dom.png "AG Grid Dom")
45
+ <br/>
46
+ <br/>
47
+ ### Getting Data From the Grid:
48
+ To get the Ag Grid data, you must chain `.getAgGridData()` after the `cy.get()` command for the topmost level of the grid, including controls and headers (see selected DOM element in above image).
49
+
50
+ Correct Usage:
51
+ ```javascript
52
+ cy.get("#myGrid").getAgGridData()
53
+ ```
54
+
55
+ Incorrect Usage:
56
+ ```javascript
57
+ cy.getAgGridData();
58
+ ```
59
+
60
+ The correct command will return the following:
61
+ ```json
62
+ [
63
+ { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
64
+ { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
65
+ { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
66
+ { "Year": "2020", "Make": "BMW", "Model": "3-series" },
67
+ { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
68
+ ]
69
+ ```
70
+ </br>
71
+ </br>
72
+
73
+ ### Getting Select Row Data
74
+ To only get certain rows of data, pass the header values into the `getAgGridData()` command, like so:
75
+
76
+ ```javascript
77
+ cy.get("#myGrid").getAgGridData({ onlyColumns: ["Year", "Make"] })
78
+ ```
79
+
80
+ The above command will return the follwoing:
81
+ ```json
82
+ [
83
+ { "Year": "2020", "Make": "Toyota"},
84
+ { "Year": "2020", "Make": "Ford"},
85
+ { "Year": "2020", "Make": "Porsche"},
86
+ { "Year": "2020", "Make": "BMW"},
87
+ { "Year": "2020", "Make": "Mercedes"},
88
+ ]
89
+ ```
90
+ </br>
91
+ </br>
92
+
93
+ ### Getting Elements From the Grid
94
+ To get the Ag Grid data as elements (if you want to interact with the cells themselves), you must chain `.getAgGridElements()` after the `cy.get()` command for the topmost level of the grid, including controls and headers (see selected DOM element in above image).
95
+ ```javascript
96
+ cy.get(agGridSelector)
97
+ .getAgGridElements()
98
+ .then((tableElements) => {
99
+ const porscheRow = tableElements.find(
100
+ (row) => row.Price.innerText === "72000"
101
+ );
102
+ const priceCell = porscheRow.Price;
103
+ cy.wrap(priceCell).dblclick().type("66000{enter}");
104
+ });
105
+
106
+ ```
107
+
108
+ The above example will grab the table as elements, finds the row whose `Price` equals `72000`. It then gets the `Price` cell for that row, double clicks on it to enable an editable input, and changes the value of the cell.
109
+ </br>
110
+ </br>
111
+
112
+ ### Sorting Columns
113
+ This command will sort the specified column by the sort direction specified.
114
+
115
+ <b>Defintion</b>:
116
+ `.agGridSortColumn(columnName:String, sortDirection:String)`
117
+
118
+ Example:
119
+
120
+ ```javascript
121
+ cy.get("#myGrid").agGridSortColumn("Model", "descending");
122
+ ```
123
+ </br>
124
+ </br>
125
+
126
+ ### Filter Options
127
+
128
+ The below filtering commands takes an `options` parameter comprised of the following properties:
129
+
130
+ ```javascript
131
+ options: {
132
+ searchCriteria: [{
133
+ columnName: string;
134
+ filterValue: string;
135
+ operator?: string;
136
+ isMultiFilter?: boolean;
137
+ }];
138
+ hasApplyButton?: boolean;
139
+ noMenuTab?: boolean;
140
+ selectAllLocaleText: string;
141
+ }
142
+
143
+ /**
144
+ - options.searchCriteria JSON with search properties and options
145
+ - options.searchCriteria.columnName name of the column to filter
146
+ - options.searchCriteria.filterValue value to input into the filter textbox
147
+ - options.searchCriteria.searchInputIndex [Optional] Uses 0 by default. Index of which filter box to use in event of having multiple search conditionals
148
+ - options.searchCriteria.operator [Optional] Use if using a search operator (i.e. Less Than, Equals, etc...use filterOperator.enum values).
149
+ - options.searchCriteria.isMultiFilter [Optional] Used when floating filter menu has checkbox options vs freeform text input.
150
+ - options.hasApplyButton [Optional] True if "Apply" button is used, false if filters by text input automatically.
151
+ - options.noMenuTabs [Optional] True if you use, for example, the community edition of ag-grid, which has no menu tabs
152
+ - options.selectAllLocaleText [Optional] Pass in the locale text value of "Select All" for when you are filtering by checkbox - this will first deselect the "Select All" option before selecting your filter value
153
+ */
154
+ ```
155
+
156
+ ### Filter by Text - Column Menu
157
+ This command will filter a column by a text value from its menu. In the options, you must specify a `searchCriteria` objects containing one or more objects with `columnName`, `filterValue`, and optionally `operator` (i.e. Contains, Not contains, Equals, etc.).
158
+
159
+ ![alt text](./ag-grid-example-filter-text-menu.png "AG Grid Dom - Filter by Text Menu")
160
+
161
+ <b>Definition:</b> `.agGridColumnFilterTextMenu(options: {})`
162
+
163
+ Example:
164
+ ```javascript
165
+ cy.get("#myGrid").agGridColumnFilterTextMenu({
166
+ searchCriteria:[{
167
+ columnName: "Model",
168
+ filterValue: "GLC300",
169
+ operator:"Equals"
170
+ },
171
+ {
172
+ columnName: "Make",
173
+ filterValue: "Mercedes",
174
+ operator:"Equals"
175
+ }
176
+ ],
177
+ hasApplyButton: false
178
+ })
179
+ ````
180
+ The above command will filter the Model column for the value 'GLC300' and set the filter operator to 'Equals'. It will then apply a secondary filter on the Make column for 'Mercedes'.
181
+ </br>
182
+ </br>
183
+ ### Filterby Text - Floating Filter
184
+ This command will filter a column by a text value from its floating filter (if applicable). This command will filter a column by a text value from its floating menu. In the options, you must specify a `searchCriteria` object with `columnName`, `filterValue`, and optionally `operator` (i.e. Contains, Not contains, Equals, etc.) and `searchInputIndex` in the event you wish to apply multiple text conditions (see below for multi-condition example).
185
+
186
+ ![alt text](./ag-grid-example-filter-text-floating.png "AG Grid Dom - Filter by Text Floating")
187
+
188
+ <b>Definition:</b> .agGridColumnFilterTextFloating(options: {})
189
+
190
+ Example:
191
+ ```
192
+ cy.get(agGridSelector).agGridColumnFilterTextFloating({
193
+ searchCriteria: {
194
+ columnName: "Make",
195
+ filterValue: "Ford",
196
+ },
197
+ hasApplyButton: true,
198
+ });
199
+ ```
200
+
201
+ The above example will search for the Make `Ford` from the floating text menu filter.
202
+
203
+ If you have the option for multiple conditions on the floating filter, you can do two searches, specifying the `searchInputIndex` parameter in the `searchCriteria` object. The below example will ssarch for any `Make` that contains `B` AND `MW`:
204
+
205
+ Example:
206
+ ```
207
+ cy.get(agGridSelector).agGridColumnFilterTextFloating({
208
+ searchCriteria: {
209
+ columnName: "Make",
210
+ filterValue: "B",
211
+ searchInputIndex: 0,
212
+ },
213
+ hasApplyButton: true,
214
+ });
215
+ cy.get(agGridSelector).agGridColumnFilterTextFloating({
216
+ searchCriteria: {
217
+ columnName: "Make",
218
+ filterValue: "MW",
219
+ searchInputIndex: 1,
220
+ },
221
+ hasApplyButton: true,
222
+ });
223
+ ```
224
+ ![alt text](./ag-grid-example-filter-text-floating-multi-condition.png "AG Grid Dom - Filter by Text Floating")
225
+
226
+ <br/>
227
+ </br>
228
+
229
+ ### Filter by Checkbox - Column Menu
230
+ This command will filter a column by a checkbox text value from its menu.
231
+ ![alt text](./ag-grid-example-filter-checkbox-menu.png "AG Grid Dom - Filter by Checkbox Menu")
232
+
233
+ Definition:
234
+ ```javascript
235
+ .agGridColumnFilterCheckboxMenu(options={})
236
+ ```
237
+
238
+ Example:
239
+ ```javascript
240
+ cy.get("#myGrid").agGridColumnFilterCheckboxMenu({
241
+ searchCriteria: {
242
+ columnName: "Model",
243
+ filterValue: "2002",
244
+ },
245
+ hasApplyButton: true,
246
+ });
247
+
248
+ ```
249
+ </br>
250
+
251
+ ### Filtering - Localization and Internationalization
252
+ When we filter by checkbox, we first deselect the Select All checkbox to ensure we ONLY select the specified checkbox. Since AG grid allows for localization, we need a way to be able to pass in the localeText for Select All. This is the only area of this plugin that has a hard-coded value, so no other localization accommodations are needed.
253
+
254
+ ```
255
+ cy.get("#myGrid").agGridColumnFilterCheckboxMenu({
256
+ searchCriteria: {
257
+ columnName: "Model",
258
+ filterValue: "2002",
259
+ },
260
+ selectAllLocaleText: "Tout Sélectionner"
261
+ hasApplyButton: true,
262
+ });
263
+ ```
264
+ </br>
265
+
266
+ ### Add or Remove Columns
267
+ This command will toggle the specified column from the grid's sidebar.
268
+
269
+ <b>Definition:</b>`.agGridToggleColumnsSideBar(columnName:String, doRemove:boolean)`
270
+
271
+ Example:
272
+ ```javascript
273
+ // This will remove the column "Year" from the grid
274
+ cy.get("#myGrid").agGridToggleColumnsSideBar("Year", true);
275
+ ```
276
+ <br/>
277
+ <br/>
278
+
279
+ ### Validate Paginated Table
280
+ This command will validate the paginated grid's data. The supplied expectedPaginatedTableData must be paginated as it's shown in the grid.
281
+
282
+ <b>Definition:</b> `agGridValidatePaginatedTable(expectedPaginatedTableData, onlyColumns = {})`
283
+
284
+ Example:
285
+ ```javascript
286
+ const expectedPaginatedTableData = [
287
+ [
288
+ { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
289
+ { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
290
+ { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
291
+ { "Year": "2020", "Make": "BMW", "Model": "3-series" },
292
+ { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
293
+ ],
294
+ [
295
+ { "Year": "2020", "Make": "Honda", "Model": "Civic" },
296
+ { "Year": "2020", "Make": "Honda", "Model": "Accord" },
297
+ { "Year": "2020", "Make": "Ford", "Model": "Taurus" },
298
+ { "Year": "2020", "Make": "Hyundai", "Model": "Elantra" },
299
+ { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
300
+ ],
301
+ ...other table data
302
+ ];
303
+ cy.get("#myGrid").agGridValidatePaginatedTable(
304
+ expectedPaginatedTableData, onlyColumns ={"Year", "Make", "Model"}
305
+ );
306
+ });
307
+ ```
308
+ <br/>
309
+ <br/>
310
+
311
+ ### Validate Table in the Exact Order
312
+ This command will verify the table data is displayed exactly in the same order as the supplied expected table data. This will ONLY validate the first page of a paginated table.
313
+
314
+ <b>Definition</b>: `.agGridValidateRowsExactOrder(actualTableData, expectedTableData)`
315
+
316
+ Example:
317
+ ```javascript
318
+ cy.get("#myGrid")
319
+ .getAgGridData()
320
+ .then((actualTableData) => {
321
+ cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
322
+ });
323
+ ```
324
+ <br/>
325
+ <br/>
326
+
327
+ ### Validate Subset of Table Data
328
+ This command will validate a subset of the table data. Ideal for verifying one or more records, or verify records without specified columns.
329
+
330
+ <b>Definition:</b>: `agGridValidateRowsSubset(actualTableData, expectedTableData)`
331
+
332
+ Example:
333
+ ```javascript
334
+ const expectedTableData = [
335
+ { "Year": "2020", "Make": "Toyota", "Model": "Celica" },
336
+ { "Year": "2020", "Make": "Ford", "Model": "Mondeo" },
337
+ { "Year": "2020", "Make": "Porsche", "Model": "Boxter" },
338
+ { "Year": "2020", "Make": "BMW", "Model": "3-series" },
339
+ { "Year": "2020", "Make": "Mercedes", "Model": "GLC300" },
340
+ ];
341
+ cy.get(agGridSelector)
342
+ .getAgGridData({ onlyColumns: ["Year", "Make", "Model"] })
343
+ .then((actualTableData) => {
344
+ cy.agGridValidateRowsSubset(actualTableData, expectedTableData);
345
+ });
346
+ });
347
+ ```
348
+ <br/>
349
+ <br/>
350
+
351
+ ### Validate Empty Grid
352
+ This will verify the table data is empty.
353
+
354
+ <b>Definition</b>:`agGridValidateEmptyTable(actualTableData, expectedTableData)`
355
+
356
+ Example:
357
+ ```javascript
358
+ cy.get(agGridSelector)
359
+ .getAgGridData()
360
+ .then((actualTableData) => {
361
+ cy.agGridValidateEmptyTable(actualTableData);
362
+ });
363
+ ```
364
+
365
+ ## Limitations
366
+ * ~~Unable to validate deeply nested row groups~~ As of v2.x, using `.getAgGridElements()` you should be able to accomplish this.
367
+ * ~~Unable to validate deeply nested column groups~~ As of v2.x, using `.getAgGridElements()` you should be able to accomplish this.
368
+ * Unable to validate the entirety of an unlimited scrolling grid.
369
+ * Unable to validate data that is out of view. The DOM will register the ag grid data as it's scrolled into view.
370
+ * To combat this, in your code where the ag grid is called, check if the Cypress window is controlling the app and set the ag grid object to `.sizeColumnsToFit()`. You can see an example of this in the `app/grid.js` file of this repository. Read more [here](https://www.ag-grid.com/javascript-grid/column-sizing/#size-columns-to-fit)
371
+ * Example:
372
+ ```javascript
373
+ if(window.Cypress){
374
+ this.api.sizeColumnsToFit();
375
+ }
376
+ ```
377
+ ## Credit
378
+ A portion of the logic to retrieve table data was expanded upon from the project [Cypress-Get-Table](https://github.com/roggerfe/cypress-get-table) by [Rogger Fernandez](https://github.com/roggerfe).