cypress-ag-grid 2.0.0 → 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/.circleci/config.yml +13 -13
- package/README.md +378 -346
- package/app/grid-basic.js +70 -70
- package/app/grid-grouped.js +71 -71
- package/app/index.html +14 -14
- package/cypress/e2e/ag-grid-data.cy.js +506 -482
- package/cypress/e2e/ag-grid-elements.cy.js +59 -59
- package/cypress/fixtures/cardata.json +21 -21
- package/cypress/plugins/index.js +22 -22
- package/cypress/support/commands.js +25 -25
- package/cypress/support/e2e.js +21 -21
- package/package.json +29 -29
- package/src/agGrid/agGridInteractions.js +538 -507
- package/src/agGrid/agGridValidations.js +38 -37
- package/src/agGrid/filterOperator.enum.js +13 -13
- package/src/agGrid/menuTab.enum.js +6 -6
- package/src/agGrid/sort.enum.js +5 -5
- package/src/index.d.ts +1 -0
- package/src/index.js +18 -18
|
@@ -1,483 +1,507 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
|
|
3
|
-
import { sort } from "../../src/agGrid/sort.enum";
|
|
4
|
-
import {
|
|
5
|
-
deleteKey,
|
|
6
|
-
sortedCollectionByProperty,
|
|
7
|
-
} from "../../src/helpers/arrayHelpers";
|
|
8
|
-
import { filterOperator } from "../../src/agGrid/filterOperator.enum";
|
|
9
|
-
|
|
10
|
-
const _pageSize = 5;
|
|
11
|
-
const agGridSelector = "#myGrid";
|
|
12
|
-
|
|
13
|
-
describe("ag-grid get data scenarios", () => {
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
cy.visit("../app/index.html");
|
|
16
|
-
cy.get(".ag-cell", { timeout: 10000 }).should("be.visible");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("verify paginated table data - include all columns", () => {
|
|
20
|
-
const expectedPaginatedTableData = [
|
|
21
|
-
[
|
|
22
|
-
{ Year: "2020", Make: "Toyota", Model: "Celica", Price: "35000" },
|
|
23
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
24
|
-
{ Year: "2020", Make: "Porsche", Model: "Boxter", Price: "72000" },
|
|
25
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
26
|
-
{ Year: "2020", Make: "Mercedes", Model: "GLC300", Price: "53000" },
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
{ Year: "2020", Make: "Honda", Model: "Civic", Price: "22000" },
|
|
30
|
-
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "32000" },
|
|
31
|
-
{ Year: "2020", Make: "Ford", Model: "Taurus", Price: "19000" },
|
|
32
|
-
{ Year: "2020", Make: "Hyundai", Model: "Elantra", Price: "22000" },
|
|
33
|
-
{ Year: "2020", Make: "Toyota", Model: "Celica", Price: "5000" },
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "25000" },
|
|
37
|
-
{ Year: "2020", Make: "Porsche", Model: "Boxter", Price: "99000" },
|
|
38
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
39
|
-
{ Year: "2020", Make: "Mercedes", Model: "GLC300", Price: "35000" },
|
|
40
|
-
{ Year: "2011", Make: "Honda", Model: "Civic", Price: "9000" },
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "34000" },
|
|
44
|
-
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
45
|
-
{ Year: "2020", Make: "Hyundai", Model: "Elantra", Price: "3000" },
|
|
46
|
-
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
47
|
-
],
|
|
48
|
-
];
|
|
49
|
-
cy.get(agGridSelector).agGridValidatePaginatedTable(
|
|
50
|
-
expectedPaginatedTableData
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("verify paginated table data - excluding columns", () => {
|
|
55
|
-
const expectedPaginatedTableData = [
|
|
56
|
-
[
|
|
57
|
-
{ Year: "2020", Make: "Toyota", Model: "Celica" },
|
|
58
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo" },
|
|
59
|
-
{ Year: "2020", Make: "Porsche", Model: "Boxter" },
|
|
60
|
-
{ Year: "2020", Make: "BMW", Model: "3-series" },
|
|
61
|
-
{ Year: "2020", Make: "Mercedes", Model: "GLC300" },
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
{ Year: "2020", Make: "Honda", Model: "Civic" },
|
|
65
|
-
{ Year: "2020", Make: "Honda", Model: "Accord" },
|
|
66
|
-
{ Year: "2020", Make: "Ford", Model: "Taurus" },
|
|
67
|
-
{ Year: "2020", Make: "Hyundai", Model: "Elantra" },
|
|
68
|
-
{ Year: "2020", Make: "Toyota", Model: "Celica" },
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo" },
|
|
72
|
-
{ Year: "2020", Make: "Porsche", Model: "Boxter" },
|
|
73
|
-
{ Year: "2020", Make: "BMW", Model: "3-series" },
|
|
74
|
-
{ Year: "2020", Make: "Mercedes", Model: "GLC300" },
|
|
75
|
-
{ Year: "2011", Make: "Honda", Model: "Civic" },
|
|
76
|
-
],
|
|
77
|
-
[
|
|
78
|
-
{ Year: "2020", Make: "Honda", Model: "Accord" },
|
|
79
|
-
{ Year: "1990", Make: "Ford", Model: "Taurus" },
|
|
80
|
-
{ Year: "2020", Make: "Hyundai", Model: "Elantra" },
|
|
81
|
-
{ Year: "2020", Make: "BMW", Model: "2002" },
|
|
82
|
-
],
|
|
83
|
-
];
|
|
84
|
-
cy.get(agGridSelector).agGridValidatePaginatedTable(
|
|
85
|
-
expectedPaginatedTableData,
|
|
86
|
-
{
|
|
87
|
-
onlyColumns: ["Year", "Make", "Model"],
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("able to filter by checkbox", () => {
|
|
93
|
-
const expectedTableData = [
|
|
94
|
-
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
95
|
-
];
|
|
96
|
-
cy.get(agGridSelector).agGridColumnFilterCheckboxMenu({
|
|
97
|
-
searchCriteria: {
|
|
98
|
-
columnName: "Model",
|
|
99
|
-
filterValue: "2002",
|
|
100
|
-
},
|
|
101
|
-
selectAllLocaleText: "Select All", // This is optional if you are using localText for ag grid
|
|
102
|
-
hasApplyButton: true,
|
|
103
|
-
});
|
|
104
|
-
cy.get(agGridSelector)
|
|
105
|
-
.getAgGridData()
|
|
106
|
-
.then((actualTableData) => {
|
|
107
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("able to filter by checkbox - multiple columns", () => {
|
|
112
|
-
const expectedTableData = [
|
|
113
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
114
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
115
|
-
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
116
|
-
];
|
|
117
|
-
cy.get(agGridSelector).agGridColumnFilterCheckboxMenu({
|
|
118
|
-
searchCriteria: [
|
|
119
|
-
{
|
|
120
|
-
columnName: "Model",
|
|
121
|
-
filterValue: "2002",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
columnName: "Model",
|
|
125
|
-
filterValue: "3-series",
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
hasApplyButton: true,
|
|
129
|
-
});
|
|
130
|
-
cy.get(agGridSelector)
|
|
131
|
-
.getAgGridData()
|
|
132
|
-
.then((actualTableData) => {
|
|
133
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData, true);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("able to filter by text - menu", () => {
|
|
138
|
-
const expectedTableData = [
|
|
139
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
140
|
-
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "32000" },
|
|
141
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
142
|
-
];
|
|
143
|
-
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
144
|
-
cy.get(agGridSelector).agGridColumnFilterTextMenu({
|
|
145
|
-
searchCriteria: {
|
|
146
|
-
columnName: "Price",
|
|
147
|
-
filterValue: "32000",
|
|
148
|
-
operator: filterOperator.equals,
|
|
149
|
-
},
|
|
150
|
-
hasApplyButton: true,
|
|
151
|
-
});
|
|
152
|
-
cy.get(agGridSelector)
|
|
153
|
-
.getAgGridData()
|
|
154
|
-
.then((actualTableData) => {
|
|
155
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("able to filter by text - menu - multiple columns", () => {
|
|
160
|
-
const expectedTableData = [
|
|
161
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
162
|
-
];
|
|
163
|
-
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
164
|
-
cy.get(agGridSelector).agGridColumnFilterTextMenu({
|
|
165
|
-
searchCriteria: [
|
|
166
|
-
{
|
|
167
|
-
columnName: "Price",
|
|
168
|
-
filterValue: "32000",
|
|
169
|
-
operator: filterOperator.equals,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
columnName: "Make",
|
|
173
|
-
filterValue: "BMW",
|
|
174
|
-
operator: filterOperator.equals,
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
hasApplyButton: true,
|
|
178
|
-
});
|
|
179
|
-
cy.get(agGridSelector)
|
|
180
|
-
.getAgGridData()
|
|
181
|
-
.then((actualTableData) => {
|
|
182
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it("able to filter by text - floating filter", () => {
|
|
187
|
-
const expectedTableData = [
|
|
188
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
189
|
-
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "25000" },
|
|
190
|
-
{ Year: "2020", Make: "Ford", Model: "Taurus", Price: "19000" },
|
|
191
|
-
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
192
|
-
];
|
|
193
|
-
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
194
|
-
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
195
|
-
searchCriteria: {
|
|
196
|
-
columnName: "Make",
|
|
197
|
-
filterValue: "Ford",
|
|
198
|
-
},
|
|
199
|
-
hasApplyButton: true,
|
|
200
|
-
});
|
|
201
|
-
cy.get(agGridSelector)
|
|
202
|
-
.getAgGridData()
|
|
203
|
-
.then((actualTableData) => {
|
|
204
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it("able to filter by text - floating filter - multiple conditions", () => {
|
|
209
|
-
const expectedTableData = [
|
|
210
|
-
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
211
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
212
|
-
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
213
|
-
];
|
|
214
|
-
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
215
|
-
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
216
|
-
searchCriteria: {
|
|
217
|
-
columnName: "Make",
|
|
218
|
-
filterValue: "B",
|
|
219
|
-
searchInputIndex: 0,
|
|
220
|
-
},
|
|
221
|
-
hasApplyButton: true,
|
|
222
|
-
});
|
|
223
|
-
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
224
|
-
searchCriteria: {
|
|
225
|
-
columnName: "Make",
|
|
226
|
-
filterValue: "MW",
|
|
227
|
-
searchInputIndex: 1,
|
|
228
|
-
},
|
|
229
|
-
hasApplyButton: true,
|
|
230
|
-
});
|
|
231
|
-
cy.get(agGridSelector)
|
|
232
|
-
.getAgGridData()
|
|
233
|
-
.then((actualTableData) => {
|
|
234
|
-
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it("able to filter by text - floating filter - multiple columns", () => {
|
|
239
|
-
const expectedTableData = [
|
|
240
|
-
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
241
|
-
];
|
|
242
|
-
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
243
|
-
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
244
|
-
searchCriteria: [
|
|
245
|
-
{
|
|
246
|
-
columnName: "Make",
|
|
247
|
-
filterValue: "Ford",
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
columnName: "Year",
|
|
251
|
-
filterValue: "1990",
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
hasApplyButton: true,
|
|
255
|
-
});
|
|
256
|
-
cy.get(agGridSelector)
|
|
257
|
-
.getAgGridData()
|
|
258
|
-
.then((actualTableData) => {
|
|
259
|
-
cy.get(agGridSelector).agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it("able to
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
cy.
|
|
306
|
-
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
cy.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
cy.
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
//
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
//
|
|
433
|
-
//
|
|
434
|
-
|
|
435
|
-
//
|
|
436
|
-
//
|
|
437
|
-
//
|
|
438
|
-
//
|
|
439
|
-
//
|
|
440
|
-
//
|
|
441
|
-
|
|
442
|
-
//
|
|
443
|
-
//
|
|
444
|
-
//
|
|
445
|
-
//
|
|
446
|
-
//
|
|
447
|
-
//
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
//
|
|
451
|
-
//
|
|
452
|
-
//
|
|
453
|
-
//
|
|
454
|
-
//
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
//
|
|
458
|
-
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
//
|
|
462
|
-
//
|
|
463
|
-
//
|
|
464
|
-
//
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
//
|
|
468
|
-
//
|
|
469
|
-
//
|
|
470
|
-
// const
|
|
471
|
-
//
|
|
472
|
-
|
|
473
|
-
//
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
477
|
-
//
|
|
478
|
-
//
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
//
|
|
482
|
-
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
import { sort } from "../../src/agGrid/sort.enum";
|
|
4
|
+
import {
|
|
5
|
+
deleteKey,
|
|
6
|
+
sortedCollectionByProperty,
|
|
7
|
+
} from "../../src/helpers/arrayHelpers";
|
|
8
|
+
import { filterOperator } from "../../src/agGrid/filterOperator.enum";
|
|
9
|
+
|
|
10
|
+
const _pageSize = 5;
|
|
11
|
+
const agGridSelector = "#myGrid";
|
|
12
|
+
|
|
13
|
+
describe("ag-grid get data scenarios", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
cy.visit("../app/index.html");
|
|
16
|
+
cy.get(".ag-cell", { timeout: 10000 }).should("be.visible");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("verify paginated table data - include all columns", () => {
|
|
20
|
+
const expectedPaginatedTableData = [
|
|
21
|
+
[
|
|
22
|
+
{ Year: "2020", Make: "Toyota", Model: "Celica", Price: "35000" },
|
|
23
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
24
|
+
{ Year: "2020", Make: "Porsche", Model: "Boxter", Price: "72000" },
|
|
25
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
26
|
+
{ Year: "2020", Make: "Mercedes", Model: "GLC300", Price: "53000" },
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
{ Year: "2020", Make: "Honda", Model: "Civic", Price: "22000" },
|
|
30
|
+
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "32000" },
|
|
31
|
+
{ Year: "2020", Make: "Ford", Model: "Taurus", Price: "19000" },
|
|
32
|
+
{ Year: "2020", Make: "Hyundai", Model: "Elantra", Price: "22000" },
|
|
33
|
+
{ Year: "2020", Make: "Toyota", Model: "Celica", Price: "5000" },
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "25000" },
|
|
37
|
+
{ Year: "2020", Make: "Porsche", Model: "Boxter", Price: "99000" },
|
|
38
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
39
|
+
{ Year: "2020", Make: "Mercedes", Model: "GLC300", Price: "35000" },
|
|
40
|
+
{ Year: "2011", Make: "Honda", Model: "Civic", Price: "9000" },
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "34000" },
|
|
44
|
+
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
45
|
+
{ Year: "2020", Make: "Hyundai", Model: "Elantra", Price: "3000" },
|
|
46
|
+
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
47
|
+
],
|
|
48
|
+
];
|
|
49
|
+
cy.get(agGridSelector).agGridValidatePaginatedTable(
|
|
50
|
+
expectedPaginatedTableData
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("verify paginated table data - excluding columns", () => {
|
|
55
|
+
const expectedPaginatedTableData = [
|
|
56
|
+
[
|
|
57
|
+
{ Year: "2020", Make: "Toyota", Model: "Celica" },
|
|
58
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo" },
|
|
59
|
+
{ Year: "2020", Make: "Porsche", Model: "Boxter" },
|
|
60
|
+
{ Year: "2020", Make: "BMW", Model: "3-series" },
|
|
61
|
+
{ Year: "2020", Make: "Mercedes", Model: "GLC300" },
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
{ Year: "2020", Make: "Honda", Model: "Civic" },
|
|
65
|
+
{ Year: "2020", Make: "Honda", Model: "Accord" },
|
|
66
|
+
{ Year: "2020", Make: "Ford", Model: "Taurus" },
|
|
67
|
+
{ Year: "2020", Make: "Hyundai", Model: "Elantra" },
|
|
68
|
+
{ Year: "2020", Make: "Toyota", Model: "Celica" },
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo" },
|
|
72
|
+
{ Year: "2020", Make: "Porsche", Model: "Boxter" },
|
|
73
|
+
{ Year: "2020", Make: "BMW", Model: "3-series" },
|
|
74
|
+
{ Year: "2020", Make: "Mercedes", Model: "GLC300" },
|
|
75
|
+
{ Year: "2011", Make: "Honda", Model: "Civic" },
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
{ Year: "2020", Make: "Honda", Model: "Accord" },
|
|
79
|
+
{ Year: "1990", Make: "Ford", Model: "Taurus" },
|
|
80
|
+
{ Year: "2020", Make: "Hyundai", Model: "Elantra" },
|
|
81
|
+
{ Year: "2020", Make: "BMW", Model: "2002" },
|
|
82
|
+
],
|
|
83
|
+
];
|
|
84
|
+
cy.get(agGridSelector).agGridValidatePaginatedTable(
|
|
85
|
+
expectedPaginatedTableData,
|
|
86
|
+
{
|
|
87
|
+
onlyColumns: ["Year", "Make", "Model"],
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("able to filter by checkbox", () => {
|
|
93
|
+
const expectedTableData = [
|
|
94
|
+
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
95
|
+
];
|
|
96
|
+
cy.get(agGridSelector).agGridColumnFilterCheckboxMenu({
|
|
97
|
+
searchCriteria: {
|
|
98
|
+
columnName: "Model",
|
|
99
|
+
filterValue: "2002",
|
|
100
|
+
},
|
|
101
|
+
selectAllLocaleText: "Select All", // This is optional if you are using localText for ag grid
|
|
102
|
+
hasApplyButton: true,
|
|
103
|
+
});
|
|
104
|
+
cy.get(agGridSelector)
|
|
105
|
+
.getAgGridData()
|
|
106
|
+
.then((actualTableData) => {
|
|
107
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("able to filter by checkbox - multiple columns", () => {
|
|
112
|
+
const expectedTableData = [
|
|
113
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
114
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
115
|
+
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
116
|
+
];
|
|
117
|
+
cy.get(agGridSelector).agGridColumnFilterCheckboxMenu({
|
|
118
|
+
searchCriteria: [
|
|
119
|
+
{
|
|
120
|
+
columnName: "Model",
|
|
121
|
+
filterValue: "2002",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
columnName: "Model",
|
|
125
|
+
filterValue: "3-series",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
hasApplyButton: true,
|
|
129
|
+
});
|
|
130
|
+
cy.get(agGridSelector)
|
|
131
|
+
.getAgGridData()
|
|
132
|
+
.then((actualTableData) => {
|
|
133
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData, true);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("able to filter by text - menu", () => {
|
|
138
|
+
const expectedTableData = [
|
|
139
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
140
|
+
{ Year: "2020", Make: "Honda", Model: "Accord", Price: "32000" },
|
|
141
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
142
|
+
];
|
|
143
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
144
|
+
cy.get(agGridSelector).agGridColumnFilterTextMenu({
|
|
145
|
+
searchCriteria: {
|
|
146
|
+
columnName: "Price",
|
|
147
|
+
filterValue: "32000",
|
|
148
|
+
operator: filterOperator.equals,
|
|
149
|
+
},
|
|
150
|
+
hasApplyButton: true,
|
|
151
|
+
});
|
|
152
|
+
cy.get(agGridSelector)
|
|
153
|
+
.getAgGridData()
|
|
154
|
+
.then((actualTableData) => {
|
|
155
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("able to filter by text - menu - multiple columns", () => {
|
|
160
|
+
const expectedTableData = [
|
|
161
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
162
|
+
];
|
|
163
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
164
|
+
cy.get(agGridSelector).agGridColumnFilterTextMenu({
|
|
165
|
+
searchCriteria: [
|
|
166
|
+
{
|
|
167
|
+
columnName: "Price",
|
|
168
|
+
filterValue: "32000",
|
|
169
|
+
operator: filterOperator.equals,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
columnName: "Make",
|
|
173
|
+
filterValue: "BMW",
|
|
174
|
+
operator: filterOperator.equals,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
hasApplyButton: true,
|
|
178
|
+
});
|
|
179
|
+
cy.get(agGridSelector)
|
|
180
|
+
.getAgGridData()
|
|
181
|
+
.then((actualTableData) => {
|
|
182
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it("able to filter by text - floating filter", () => {
|
|
187
|
+
const expectedTableData = [
|
|
188
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "32000" },
|
|
189
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo", Price: "25000" },
|
|
190
|
+
{ Year: "2020", Make: "Ford", Model: "Taurus", Price: "19000" },
|
|
191
|
+
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
192
|
+
];
|
|
193
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
194
|
+
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
195
|
+
searchCriteria: {
|
|
196
|
+
columnName: "Make",
|
|
197
|
+
filterValue: "Ford",
|
|
198
|
+
},
|
|
199
|
+
hasApplyButton: true,
|
|
200
|
+
});
|
|
201
|
+
cy.get(agGridSelector)
|
|
202
|
+
.getAgGridData()
|
|
203
|
+
.then((actualTableData) => {
|
|
204
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("able to filter by text - floating filter - multiple conditions", () => {
|
|
209
|
+
const expectedTableData = [
|
|
210
|
+
{ Year: "2020", Make: "BMW", Model: "2002", Price: "88001" },
|
|
211
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "45000" },
|
|
212
|
+
{ Year: "2020", Make: "BMW", Model: "3-series", Price: "32000" },
|
|
213
|
+
];
|
|
214
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
215
|
+
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
216
|
+
searchCriteria: {
|
|
217
|
+
columnName: "Make",
|
|
218
|
+
filterValue: "B",
|
|
219
|
+
searchInputIndex: 0,
|
|
220
|
+
},
|
|
221
|
+
hasApplyButton: true,
|
|
222
|
+
});
|
|
223
|
+
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
224
|
+
searchCriteria: {
|
|
225
|
+
columnName: "Make",
|
|
226
|
+
filterValue: "MW",
|
|
227
|
+
searchInputIndex: 1,
|
|
228
|
+
},
|
|
229
|
+
hasApplyButton: true,
|
|
230
|
+
});
|
|
231
|
+
cy.get(agGridSelector)
|
|
232
|
+
.getAgGridData()
|
|
233
|
+
.then((actualTableData) => {
|
|
234
|
+
cy.agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it("able to filter by text - floating filter - multiple columns", () => {
|
|
239
|
+
const expectedTableData = [
|
|
240
|
+
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
241
|
+
];
|
|
242
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
243
|
+
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
244
|
+
searchCriteria: [
|
|
245
|
+
{
|
|
246
|
+
columnName: "Make",
|
|
247
|
+
filterValue: "Ford",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
columnName: "Year",
|
|
251
|
+
filterValue: "1990",
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
hasApplyButton: true,
|
|
255
|
+
});
|
|
256
|
+
cy.get(agGridSelector)
|
|
257
|
+
.getAgGridData()
|
|
258
|
+
.then((actualTableData) => {
|
|
259
|
+
cy.get(agGridSelector).agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("able to filter by text - floating filter - multi filter", () => {
|
|
264
|
+
const expectedTableData = [
|
|
265
|
+
{ Year: "2020", Make: "Ford", Model: "Taurus", Price: "19000" },
|
|
266
|
+
{ Year: "1990", Make: "Ford", Model: "Taurus", Price: "900" },
|
|
267
|
+
];
|
|
268
|
+
cy.get(agGridSelector).agGridSortColumn("Model", sort.ascending);
|
|
269
|
+
cy.get(agGridSelector).agGridColumnFilterTextFloating({
|
|
270
|
+
searchCriteria: [
|
|
271
|
+
{
|
|
272
|
+
columnName: "Model",
|
|
273
|
+
filterValue: "Taurus",
|
|
274
|
+
isMultiFilter: true
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
hasApplyButton: true,
|
|
278
|
+
});
|
|
279
|
+
cy.get(agGridSelector)
|
|
280
|
+
.getAgGridData()
|
|
281
|
+
.then((actualTableData) => {
|
|
282
|
+
cy.get(agGridSelector).agGridValidateRowsExactOrder(actualTableData, expectedTableData);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
it("able to validate empty table", () => {
|
|
288
|
+
//Search for an entry that does not exist
|
|
289
|
+
cy.get(agGridSelector).agGridColumnFilterTextMenu({
|
|
290
|
+
searchCriteria: {
|
|
291
|
+
columnName: "Price",
|
|
292
|
+
filterValue: "0",
|
|
293
|
+
operator: filterOperator.equals,
|
|
294
|
+
},
|
|
295
|
+
hasApplyButton: true,
|
|
296
|
+
});
|
|
297
|
+
cy.get(agGridSelector)
|
|
298
|
+
.getAgGridData()
|
|
299
|
+
.then((actualTableData) => {
|
|
300
|
+
cy.agGridValidateEmptyTable(actualTableData);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it("able to sort by ascending order", () => {
|
|
305
|
+
cy.get(agGridSelector).agGridSortColumn("Make", sort.ascending);
|
|
306
|
+
cy.fixture("cardata").then((carData) => {
|
|
307
|
+
// This will sort the entirety of our collection by the specified columnName and sort order
|
|
308
|
+
// and will return only the # of records specified. In this example, I include only the first
|
|
309
|
+
// page of data.
|
|
310
|
+
const expectedData_sortedByAscending = sortedCollectionByProperty(
|
|
311
|
+
carData,
|
|
312
|
+
"Make",
|
|
313
|
+
sort.ascending,
|
|
314
|
+
_pageSize
|
|
315
|
+
);
|
|
316
|
+
cy.get(agGridSelector)
|
|
317
|
+
.getAgGridData()
|
|
318
|
+
.then((actualTableData) => {
|
|
319
|
+
cy.agGridValidateRowsExactOrder(
|
|
320
|
+
actualTableData,
|
|
321
|
+
expectedData_sortedByAscending
|
|
322
|
+
);
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("able to sort by descending order", () => {
|
|
328
|
+
cy.get(agGridSelector).agGridSortColumn("Make", sort.descending);
|
|
329
|
+
cy.fixture("cardata").then((carData) => {
|
|
330
|
+
// This will sort the entirety of our collection by the specified columnName and sort order
|
|
331
|
+
// and will return only the # of records specified. In this example, I include only the first
|
|
332
|
+
// page of data.
|
|
333
|
+
const expectedData_sortedByDescending = sortedCollectionByProperty(
|
|
334
|
+
carData,
|
|
335
|
+
"Make",
|
|
336
|
+
sort.descending,
|
|
337
|
+
_pageSize
|
|
338
|
+
);
|
|
339
|
+
cy.get(agGridSelector)
|
|
340
|
+
.getAgGridData()
|
|
341
|
+
.then((actualTableData) => {
|
|
342
|
+
cy.agGridValidateRowsExactOrder(
|
|
343
|
+
actualTableData,
|
|
344
|
+
expectedData_sortedByDescending
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it("remove column from grid and verify select column data", () => {
|
|
351
|
+
cy.get(agGridSelector).agGridToggleColumnsSideBar("Year", true);
|
|
352
|
+
cy.fixture("cardata").then((expectedTableData) => {
|
|
353
|
+
const expectedData_yearColumnRemoved = removePropertyFromCollection(
|
|
354
|
+
expectedTableData,
|
|
355
|
+
["Year"]
|
|
356
|
+
);
|
|
357
|
+
cy.get(agGridSelector)
|
|
358
|
+
.getAgGridData()
|
|
359
|
+
.then((actualTableData) => {
|
|
360
|
+
cy.agGridValidateRowsExactOrder(
|
|
361
|
+
actualTableData,
|
|
362
|
+
expectedData_yearColumnRemoved.slice(0, _pageSize)
|
|
363
|
+
);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it("remove single pinned column from grid and verify select column data", () => {
|
|
369
|
+
cy.get(agGridSelector).agGridToggleColumnsSideBar("Price", true);
|
|
370
|
+
cy.fixture("cardata").then((expectedTableData) => {
|
|
371
|
+
const expectedData_priceColumnRemoved = removePropertyFromCollection(
|
|
372
|
+
expectedTableData,
|
|
373
|
+
["Price"]
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
cy.get(agGridSelector)
|
|
377
|
+
.getAgGridData()
|
|
378
|
+
.then((actualTableData) => {
|
|
379
|
+
cy.agGridValidateRowsExactOrder(
|
|
380
|
+
actualTableData,
|
|
381
|
+
expectedData_priceColumnRemoved.slice(0, _pageSize)
|
|
382
|
+
);
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it("remove multiple columns from grid and verify select column data", () => {
|
|
388
|
+
cy.get(agGridSelector).agGridToggleColumnsSideBar("Price", true);
|
|
389
|
+
cy.get(agGridSelector).agGridToggleColumnsSideBar("Make", true);
|
|
390
|
+
cy.fixture("cardata").then((expectedTableData) => {
|
|
391
|
+
const expectedData_multipleColumnsRemoved = removePropertyFromCollection(
|
|
392
|
+
expectedTableData,
|
|
393
|
+
["Price", "Make"]
|
|
394
|
+
);
|
|
395
|
+
cy.get(agGridSelector)
|
|
396
|
+
.getAgGridData()
|
|
397
|
+
.then((actualTableData) => {
|
|
398
|
+
cy.agGridValidateRowsExactOrder(
|
|
399
|
+
actualTableData,
|
|
400
|
+
expectedData_multipleColumnsRemoved.slice(0, _pageSize)
|
|
401
|
+
);
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
it("only validate select column data", () => {
|
|
407
|
+
const expectedTableData = [
|
|
408
|
+
{ Year: "2020", Make: "Toyota", Model: "Celica" },
|
|
409
|
+
{ Year: "2020", Make: "Ford", Model: "Mondeo" },
|
|
410
|
+
{ Year: "2020", Make: "Porsche", Model: "Boxter" },
|
|
411
|
+
{ Year: "2020", Make: "BMW", Model: "3-series" },
|
|
412
|
+
{ Year: "2020", Make: "Mercedes", Model: "GLC300" },
|
|
413
|
+
];
|
|
414
|
+
cy.get(agGridSelector)
|
|
415
|
+
.getAgGridData({ onlyColumns: ["Year", "Make", "Model"] })
|
|
416
|
+
.then((actualTableData) => {
|
|
417
|
+
cy.agGridValidateRowsSubset(actualTableData, expectedTableData);
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
function removePropertyFromCollection(expectedTableData, columnsToExclude) {
|
|
423
|
+
//Exclude any specified columns
|
|
424
|
+
if (columnsToExclude) {
|
|
425
|
+
columnsToExclude.forEach((excludedColumn) => {
|
|
426
|
+
expectedTableData.forEach((obj) => deleteKey(obj, excludedColumn));
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
return expectedTableData;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// /// THE BELOW METHODS SHOWCASE HOW TO DYNAMICALLY GET THE EXPECTED DATA AND MANIPULATE IT FOR VALIDATION
|
|
433
|
+
// /// THIS INCLUDES PAGINATION, FILTERING, and COLUMN EXCLUSION
|
|
434
|
+
|
|
435
|
+
// export const carColumns = {
|
|
436
|
+
// year: "Year",
|
|
437
|
+
// make: "Make",
|
|
438
|
+
// model: "Model",
|
|
439
|
+
// price: "Price",
|
|
440
|
+
// };
|
|
441
|
+
|
|
442
|
+
// /**
|
|
443
|
+
// * Returns ALL expected table data populated from the expected test data call and does not factor in pagination
|
|
444
|
+
// * @param columnsToExclude Provide an array of string values for columns to not return in the data set
|
|
445
|
+
// * @param filters a "\^" delimited string of all columns and values to search for in the grid (i.e. "Name=John Smith^Rate Plan=Standard"
|
|
446
|
+
// */
|
|
447
|
+
// export function getExpectedTableData(columnsToExclude, filters) {
|
|
448
|
+
// let table = [];
|
|
449
|
+
|
|
450
|
+
// // Get the expected table data from the cardata fixture file and process it with columns exclusions and filters
|
|
451
|
+
// return cy
|
|
452
|
+
// .fixture("cardata")
|
|
453
|
+
// .then((cars) => {
|
|
454
|
+
// table = cars;
|
|
455
|
+
// })
|
|
456
|
+
// .then(() => {
|
|
457
|
+
// // Iterate over all filter strings and filter table results in the order in which they are provided
|
|
458
|
+
// if (filters) {
|
|
459
|
+
// filters.split("^").forEach((filter) => {
|
|
460
|
+
// const [key, value] = filter.split("=");
|
|
461
|
+
// const getKey = getKeyByValue(carColumns, key);
|
|
462
|
+
// table = table.filter((a) => a[getKey].includes(value));
|
|
463
|
+
// });
|
|
464
|
+
// }
|
|
465
|
+
// })
|
|
466
|
+
// .then(() => {
|
|
467
|
+
// // Update the property key values to match what is represented in the grid for validation purposes
|
|
468
|
+
// // (i.e. in this example, we change make to Make, model to Model, and price to Price to match
|
|
469
|
+
// // what is shown in the grid headers exactly).
|
|
470
|
+
// for (const key in carColumns)
|
|
471
|
+
// table.forEach((obj) => renameKey(obj, key, carColumns[key]));
|
|
472
|
+
|
|
473
|
+
// //Exclude any specified columns
|
|
474
|
+
// if (columnsToExclude) {
|
|
475
|
+
// columnsToExclude.forEach((excludedColumn) => {
|
|
476
|
+
// table.forEach((obj) => deleteKey(obj, excludedColumn));
|
|
477
|
+
// });
|
|
478
|
+
// }
|
|
479
|
+
// return table;
|
|
480
|
+
// });
|
|
481
|
+
// }
|
|
482
|
+
|
|
483
|
+
// /**
|
|
484
|
+
// * Returns ALL expected table data and paginates the data based on the pageSize
|
|
485
|
+
// * @param columnsToExclude Provide an array of string values for columns to not return in the data set
|
|
486
|
+
// * @param pageSize If no value is provided, default value of 5 items per page is used
|
|
487
|
+
// */
|
|
488
|
+
// function getExpectedPaginatedTableData(columnsToExclude, pageSize = 5) {
|
|
489
|
+
// const paginatedTableData = [];
|
|
490
|
+
// // paginates the expected table data, and removes specified column exclusions
|
|
491
|
+
// return getExpectedTableData(columnsToExclude)
|
|
492
|
+
// .then((tableData) => {
|
|
493
|
+
// const pages = Math.floor(tableData.length / pageSize);
|
|
494
|
+
// const finalPageCount = tableData.length % pageSize;
|
|
495
|
+
// let iterator = 0;
|
|
496
|
+
// for (let i = 0; i < pages; i++) {
|
|
497
|
+
// paginatedTableData.push(tableData.slice(iterator, iterator + pageSize));
|
|
498
|
+
// iterator += pageSize;
|
|
499
|
+
// }
|
|
500
|
+
// paginatedTableData.push(
|
|
501
|
+
// tableData.slice(iterator, iterator + finalPageCount)
|
|
502
|
+
// );
|
|
503
|
+
// })
|
|
504
|
+
// .then(() => {
|
|
505
|
+
// return paginatedTableData;
|
|
506
|
+
// });
|
|
483
507
|
// }
|