@atomic-testing/component-driver-mui-x-v8 0.77.0 → 0.79.0
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/dist/{index.js → index.cjs} +39 -72
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +9 -9
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +6 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -6
- package/dist/index.js.map +0 -1
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
const __atomic_testing_core = __toESM(require("@atomic-testing/core"));
|
|
25
|
-
const __atomic_testing_component_driver_html = __toESM(require("@atomic-testing/component-driver-html"));
|
|
1
|
+
let _atomic_testing_core = require("@atomic-testing/core");
|
|
2
|
+
let _atomic_testing_component_driver_html = require("@atomic-testing/component-driver-html");
|
|
26
3
|
|
|
27
4
|
//#region src/components/datagrid/DataGridRowDriverBase.ts
|
|
28
5
|
const columnStartingIndex = 1;
|
|
29
6
|
/**
|
|
30
7
|
* Base class for data grid row
|
|
31
8
|
*/
|
|
32
|
-
var DataGridRowDriverBase = class extends
|
|
9
|
+
var DataGridRowDriverBase = class extends _atomic_testing_core.ComponentDriver {
|
|
33
10
|
async getCellCount() {
|
|
34
11
|
let count = 0;
|
|
35
|
-
for await (const _ of
|
|
12
|
+
for await (const _ of _atomic_testing_core.listHelper.getListItemIterator(this, this.getCellLocator(), _atomic_testing_component_driver_html.HTMLElementDriver, columnStartingIndex)) count++;
|
|
36
13
|
return count;
|
|
37
14
|
}
|
|
38
15
|
/**
|
|
@@ -42,7 +19,7 @@ var DataGridRowDriverBase = class extends __atomic_testing_core.ComponentDriver
|
|
|
42
19
|
*/
|
|
43
20
|
async getRowText() {
|
|
44
21
|
const textList = [];
|
|
45
|
-
for await (const cell of
|
|
22
|
+
for await (const cell of _atomic_testing_core.listHelper.getListItemIterator(this, this.getCellLocator(), _atomic_testing_component_driver_html.HTMLElementDriver, columnStartingIndex)) {
|
|
46
23
|
const text = await cell.getText();
|
|
47
24
|
textList.push(text.trim());
|
|
48
25
|
}
|
|
@@ -55,13 +32,12 @@ var DataGridRowDriverBase = class extends __atomic_testing_core.ComponentDriver
|
|
|
55
32
|
* @param driverClass The driver class of the cell. Default is HTMLElementDriver
|
|
56
33
|
* @returns A promise of the cell driver, or null if the cell is not found
|
|
57
34
|
*/
|
|
58
|
-
async getCell(cellIndexOrField, driverClass =
|
|
35
|
+
async getCell(cellIndexOrField, driverClass = _atomic_testing_component_driver_html.HTMLElementDriver) {
|
|
59
36
|
let cellLocator;
|
|
60
|
-
if (typeof cellIndexOrField === "number") cellLocator = (0,
|
|
61
|
-
else cellLocator = (0,
|
|
62
|
-
const locator =
|
|
63
|
-
|
|
64
|
-
if (cellExists) return new driverClass(locator, this.interactor, this.commutableOption);
|
|
37
|
+
if (typeof cellIndexOrField === "number") cellLocator = (0, _atomic_testing_core.byAttribute)("data-colindex", cellIndexOrField.toString());
|
|
38
|
+
else cellLocator = (0, _atomic_testing_core.byAttribute)("data-field", cellIndexOrField);
|
|
39
|
+
const locator = _atomic_testing_core.locatorUtil.append(this.locator, cellLocator);
|
|
40
|
+
if (await this.interactor.exists(locator)) return new driverClass(locator, this.interactor, this.commutableOption);
|
|
65
41
|
return null;
|
|
66
42
|
}
|
|
67
43
|
};
|
|
@@ -69,13 +45,12 @@ var DataGridRowDriverBase = class extends __atomic_testing_core.ComponentDriver
|
|
|
69
45
|
//#endregion
|
|
70
46
|
//#region src/components/datagrid/DataGridDataRowDriver.ts
|
|
71
47
|
var DataGridDataRowDriver = class extends DataGridRowDriverBase {
|
|
72
|
-
_dataCellLocator;
|
|
73
48
|
constructor(locator, interactor, option) {
|
|
74
49
|
super(locator, interactor, {
|
|
75
50
|
...option,
|
|
76
51
|
parts: {}
|
|
77
52
|
});
|
|
78
|
-
this._dataCellLocator =
|
|
53
|
+
this._dataCellLocator = _atomic_testing_core.locatorUtil.append(locator, (0, _atomic_testing_core.byRole)("cell"));
|
|
79
54
|
}
|
|
80
55
|
getCellLocator() {
|
|
81
56
|
return this._dataCellLocator;
|
|
@@ -88,13 +63,12 @@ var DataGridDataRowDriver = class extends DataGridRowDriverBase {
|
|
|
88
63
|
//#endregion
|
|
89
64
|
//#region src/components/datagrid/DataGridHeaderRowDriver.ts
|
|
90
65
|
var DataGridHeaderRowDriver = class extends DataGridRowDriverBase {
|
|
91
|
-
_headerCellLocator;
|
|
92
66
|
constructor(locator, interactor, option) {
|
|
93
67
|
super(locator, interactor, {
|
|
94
68
|
...option,
|
|
95
69
|
parts: {}
|
|
96
70
|
});
|
|
97
|
-
this._headerCellLocator =
|
|
71
|
+
this._headerCellLocator = _atomic_testing_core.locatorUtil.append(locator, (0, _atomic_testing_core.byRole)("columnheader"));
|
|
98
72
|
}
|
|
99
73
|
async getColumnCount() {
|
|
100
74
|
return this.getCellCount();
|
|
@@ -111,19 +85,19 @@ var DataGridHeaderRowDriver = class extends DataGridRowDriverBase {
|
|
|
111
85
|
//#region src/components/datagrid/DataGridPaginationActionDriver.ts
|
|
112
86
|
const parts$2 = {
|
|
113
87
|
previousButton: {
|
|
114
|
-
locator: (0,
|
|
115
|
-
driver:
|
|
88
|
+
locator: (0, _atomic_testing_core.byAttribute)("aria-label", "Go to previous page"),
|
|
89
|
+
driver: _atomic_testing_component_driver_html.HTMLButtonDriver
|
|
116
90
|
},
|
|
117
91
|
nextButton: {
|
|
118
|
-
locator: (0,
|
|
119
|
-
driver:
|
|
92
|
+
locator: (0, _atomic_testing_core.byAttribute)("aria-label", "Go to next page"),
|
|
93
|
+
driver: _atomic_testing_component_driver_html.HTMLButtonDriver
|
|
120
94
|
}
|
|
121
95
|
};
|
|
122
96
|
/**
|
|
123
97
|
* Driver for Material UI v6 DataGridPro component.
|
|
124
98
|
* @see https://mui.com/x/react-data-grid/
|
|
125
99
|
*/
|
|
126
|
-
var DataGridPaginationActionDriver = class extends
|
|
100
|
+
var DataGridPaginationActionDriver = class extends _atomic_testing_core.ComponentDriver {
|
|
127
101
|
constructor(locator, interactor, option) {
|
|
128
102
|
super(locator, interactor, {
|
|
129
103
|
...option,
|
|
@@ -132,8 +106,7 @@ var DataGridPaginationActionDriver = class extends __atomic_testing_core.Compone
|
|
|
132
106
|
}
|
|
133
107
|
async isPreviousPageEnabled() {
|
|
134
108
|
await this.enforcePartExistence("previousButton");
|
|
135
|
-
|
|
136
|
-
return !isDisabled;
|
|
109
|
+
return !await this.parts.previousButton.isDisabled();
|
|
137
110
|
}
|
|
138
111
|
async gotoPreviousPage() {
|
|
139
112
|
await this.enforcePartExistence("previousButton");
|
|
@@ -141,8 +114,7 @@ var DataGridPaginationActionDriver = class extends __atomic_testing_core.Compone
|
|
|
141
114
|
}
|
|
142
115
|
async isNextPageEnabled() {
|
|
143
116
|
await this.enforcePartExistence("nextButton");
|
|
144
|
-
|
|
145
|
-
return !isDisabled;
|
|
117
|
+
return !await this.parts.nextButton.isDisabled();
|
|
146
118
|
}
|
|
147
119
|
async gotoNextPage() {
|
|
148
120
|
await this.enforcePartExistence("nextButton");
|
|
@@ -157,19 +129,19 @@ var DataGridPaginationActionDriver = class extends __atomic_testing_core.Compone
|
|
|
157
129
|
//#region src/components/datagrid/DataGridFooterDriver.ts
|
|
158
130
|
const parts$1 = {
|
|
159
131
|
paginationAction: {
|
|
160
|
-
locator: (0,
|
|
132
|
+
locator: (0, _atomic_testing_core.byCssClass)("MuiTablePagination-actions"),
|
|
161
133
|
driver: DataGridPaginationActionDriver
|
|
162
134
|
},
|
|
163
135
|
paginationDescription: {
|
|
164
|
-
locator: (0,
|
|
165
|
-
driver:
|
|
136
|
+
locator: (0, _atomic_testing_core.byCssClass)("MuiTablePagination-displayedRows"),
|
|
137
|
+
driver: _atomic_testing_component_driver_html.HTMLElementDriver
|
|
166
138
|
}
|
|
167
139
|
};
|
|
168
140
|
/**
|
|
169
141
|
* Driver for Material UI v6 DataGridPro component.
|
|
170
142
|
* @see https://mui.com/x/react-data-grid/
|
|
171
143
|
*/
|
|
172
|
-
var DataGridFooterDriver = class extends
|
|
144
|
+
var DataGridFooterDriver = class extends _atomic_testing_core.ComponentDriver {
|
|
173
145
|
constructor(locator, interactor, option) {
|
|
174
146
|
super(locator, interactor, {
|
|
175
147
|
...option,
|
|
@@ -205,30 +177,30 @@ var DataGridFooterDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
205
177
|
//#region src/components/datagrid/DataGridProDriver.ts
|
|
206
178
|
const parts = {
|
|
207
179
|
headerRow: {
|
|
208
|
-
locator: (0,
|
|
180
|
+
locator: (0, _atomic_testing_core.byCssClass)("MuiDataGrid-columnHeaders").chain((0, _atomic_testing_core.byCssSelector)("[role=row]:first-of-type")),
|
|
209
181
|
driver: DataGridHeaderRowDriver
|
|
210
182
|
},
|
|
211
183
|
loading: {
|
|
212
|
-
locator: (0,
|
|
213
|
-
driver:
|
|
184
|
+
locator: (0, _atomic_testing_core.byRole)("progressbar"),
|
|
185
|
+
driver: _atomic_testing_component_driver_html.HTMLElementDriver
|
|
214
186
|
},
|
|
215
187
|
skeletonOverlay: {
|
|
216
|
-
locator: (0,
|
|
217
|
-
driver:
|
|
188
|
+
locator: (0, _atomic_testing_core.byCssClass)("MuiDataGrid-main--hasSkeletonLoadingOverlay"),
|
|
189
|
+
driver: _atomic_testing_component_driver_html.HTMLElementDriver
|
|
218
190
|
},
|
|
219
191
|
footer: {
|
|
220
|
-
locator: (0,
|
|
192
|
+
locator: (0, _atomic_testing_core.byCssClass)("MuiDataGrid-footerContainer"),
|
|
221
193
|
driver: DataGridFooterDriver
|
|
222
194
|
}
|
|
223
195
|
};
|
|
224
|
-
const dataRowLocator = (0,
|
|
196
|
+
const dataRowLocator = (0, _atomic_testing_core.byCssSelector)("[role=row][data-rowindex]");
|
|
225
197
|
/**
|
|
226
198
|
* Driver for Material UI v8 DataGridPro component.
|
|
227
199
|
* V8 DataGridPro component does not support data-testid, to use data-testid
|
|
228
200
|
* to locate the component, you need to put the data-testid on the parent element of the grid
|
|
229
201
|
* @see https://mui.com/x/react-data-grid/
|
|
230
202
|
*/
|
|
231
|
-
var DataGridProDriver = class extends
|
|
203
|
+
var DataGridProDriver = class extends _atomic_testing_core.ComponentDriver {
|
|
232
204
|
constructor(locator, interactor, option) {
|
|
233
205
|
super(locator, interactor, {
|
|
234
206
|
...option,
|
|
@@ -240,8 +212,7 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
240
212
|
* @returns A promise that resolves to a boolean indicating if the data grid is loading.
|
|
241
213
|
*/
|
|
242
214
|
async isLoading() {
|
|
243
|
-
|
|
244
|
-
return result.some((v) => v);
|
|
215
|
+
return (await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()])).some((v) => v);
|
|
245
216
|
}
|
|
246
217
|
/**
|
|
247
218
|
* Waits for the data grid to exit the loading state.
|
|
@@ -276,9 +247,9 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
276
247
|
* @returns The number of columns currently displayed in the data grid
|
|
277
248
|
*/
|
|
278
249
|
async getRowCount() {
|
|
279
|
-
const gridRowLocator =
|
|
250
|
+
const gridRowLocator = _atomic_testing_core.locatorUtil.append(this.locator, dataRowLocator);
|
|
280
251
|
let count = 0;
|
|
281
|
-
for await (const _ of
|
|
252
|
+
for await (const _ of _atomic_testing_core.listHelper.getListItemIterator(this, gridRowLocator, _atomic_testing_component_driver_html.HTMLElementDriver)) count++;
|
|
282
253
|
return count;
|
|
283
254
|
}
|
|
284
255
|
/**
|
|
@@ -287,9 +258,8 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
287
258
|
* @returns
|
|
288
259
|
*/
|
|
289
260
|
async getRow(rowIndex) {
|
|
290
|
-
const rowLocator =
|
|
291
|
-
|
|
292
|
-
if (rowExists) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
|
|
261
|
+
const rowLocator = _atomic_testing_core.locatorUtil.append(this.locator, (0, _atomic_testing_core.byCssSelector)(`[role=row][data-rowindex="${rowIndex}"]`));
|
|
262
|
+
if (await this.interactor.exists(rowLocator)) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
|
|
293
263
|
return null;
|
|
294
264
|
}
|
|
295
265
|
/**
|
|
@@ -309,7 +279,7 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
309
279
|
* @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver
|
|
310
280
|
* @returns
|
|
311
281
|
*/
|
|
312
|
-
async getCell(query, driverClass =
|
|
282
|
+
async getCell(query, driverClass = _atomic_testing_component_driver_html.HTMLElementDriver) {
|
|
313
283
|
const rowDriver = await this.getRow(query.rowIndex);
|
|
314
284
|
if (rowDriver === null) return null;
|
|
315
285
|
if ("columnIndex" in query) return rowDriver.getCell(query.columnIndex, driverClass);
|
|
@@ -322,10 +292,7 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
322
292
|
*/
|
|
323
293
|
async getCellText(query) {
|
|
324
294
|
const cell = await this.getCell(query);
|
|
325
|
-
if (cell != null)
|
|
326
|
-
const text = await cell.getText();
|
|
327
|
-
return text;
|
|
328
|
-
}
|
|
295
|
+
if (cell != null) return await cell.getText();
|
|
329
296
|
throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);
|
|
330
297
|
}
|
|
331
298
|
/**
|
|
@@ -378,4 +345,4 @@ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
|
|
|
378
345
|
exports.DataGridDataRowDriver = DataGridDataRowDriver;
|
|
379
346
|
exports.DataGridHeaderRowDriver = DataGridHeaderRowDriver;
|
|
380
347
|
exports.DataGridProDriver = DataGridProDriver;
|
|
381
|
-
//# sourceMappingURL=index.
|
|
348
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ComponentDriver","listHelper","HTMLElementDriver","textList: string[]","cellLocator: PartLocator","locatorUtil","locatorUtil","locatorUtil","parts","HTMLButtonDriver","ComponentDriver","parts","HTMLElementDriver","ComponentDriver","HTMLElementDriver","ComponentDriver","locatorUtil","listHelper"],"sources":["../src/components/datagrid/DataGridRowDriverBase.ts","../src/components/datagrid/DataGridDataRowDriver.ts","../src/components/datagrid/DataGridHeaderRowDriver.ts","../src/components/datagrid/DataGridPaginationActionDriver.ts","../src/components/datagrid/DataGridFooterDriver.ts","../src/components/datagrid/DataGridProDriver.ts"],"sourcesContent":["import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport { byAttribute, ComponentDriver, listHelper, locatorUtil, PartLocator } from '@atomic-testing/core';\n\n// In MUI7, there is an extra div preceding the actual data cells. We need to skip it.\nconst columnStartingIndex = 1;\n\n/**\n * Base class for data grid row\n */\nexport abstract class DataGridRowDriverBase extends ComponentDriver {\n protected async getCellCount(): Promise<number> {\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n count++;\n }\n return count;\n }\n\n /**\n * Get the text of each visible cell in the row.\n * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.\n * @returns A promise array of text of each visible cell in the row\n */\n async getRowText(): Promise<string[]> {\n const textList: string[] = [];\n for await (const cell of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n const text = await cell.getText();\n textList.push(text!.trim());\n }\n return textList;\n }\n\n /**\n * Get the cell driver at the specified index or data field.\n * Caveat: Because of virtualization, the cell may not be available until the cell is visible.\n * @param cellIndexOrField number: column index, string: column field\n * @param driverClass The driver class of the cell. Default is HTMLElementDriver\n * @returns A promise of the cell driver, or null if the cell is not found\n */\n async getCell<DriverT extends ComponentDriver>(\n cellIndexOrField: number | string, // number: column index, string: column field\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n let cellLocator: PartLocator;\n if (typeof cellIndexOrField === 'number') {\n cellLocator = byAttribute('data-colindex', cellIndexOrField.toString());\n } else {\n cellLocator = byAttribute('data-field', cellIndexOrField);\n }\n const locator = locatorUtil.append(this.locator, cellLocator);\n const cellExists = await this.interactor.exists(locator);\n if (cellExists) {\n // @ts-ignore\n return new driverClass(locator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n protected abstract getCellLocator(): PartLocator;\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridDataRowDriver extends DataGridRowDriverBase {\n private readonly _dataCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._dataCellLocator = locatorUtil.append(locator, byRole('cell'));\n }\n\n protected override getCellLocator(): PartLocator {\n return this._dataCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridDataRowDriver';\n }\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridHeaderRowDriver extends DataGridRowDriverBase {\n private readonly _headerCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._headerCellLocator = locatorUtil.append(locator, byRole('columnheader'));\n }\n\n async getColumnCount(): Promise<number> {\n return this.getCellCount();\n }\n\n protected override getCellLocator(): PartLocator {\n return this._headerCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridHeaderRowDriver';\n }\n}\n","import { HTMLButtonDriver } from '@atomic-testing/component-driver-html';\nimport {\n byAttribute,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nconst parts = {\n previousButton: {\n locator: byAttribute('aria-label', 'Go to previous page'),\n driver: HTMLButtonDriver,\n },\n nextButton: {\n locator: byAttribute('aria-label', 'Go to next page'),\n driver: HTMLButtonDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridPaginationActionDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('previousButton');\n const isDisabled = await this.parts.previousButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('previousButton');\n await this.parts.previousButton.click();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('nextButton');\n const isDisabled = await this.parts.nextButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('nextButton');\n await this.parts.nextButton.click();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridPaginationActionDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridPaginationActionDriver } from './DataGridPaginationActionDriver';\n\nconst parts = {\n paginationAction: {\n locator: byCssClass('MuiTablePagination-actions'),\n driver: DataGridPaginationActionDriver,\n },\n paginationDescription: {\n locator: byCssClass('MuiTablePagination-displayedRows'),\n driver: HTMLElementDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridFooterDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isPreviousPageEnabled();\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoPreviousPage();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isNextPageEnabled();\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoNextPage();\n }\n\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('paginationDescription');\n return this.parts.paginationDescription.getText();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridFooterDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n byCssSelector,\n byRole,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n listHelper,\n locatorUtil,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridCellQuery } from './DataGridCellQuery';\nimport { DataGridFooterDriver } from './DataGridFooterDriver';\nimport { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';\n\nconst parts = {\n headerRow: {\n locator: byCssClass('MuiDataGrid-columnHeaders').chain(byCssSelector('[role=row]:first-of-type')),\n driver: DataGridHeaderRowDriver,\n },\n loading: {\n locator: byRole('progressbar'),\n driver: HTMLElementDriver,\n },\n skeletonOverlay: {\n locator: byCssClass('MuiDataGrid-main--hasSkeletonLoadingOverlay'),\n driver: HTMLElementDriver,\n },\n footer: {\n locator: byCssClass('MuiDataGrid-footerContainer'),\n driver: DataGridFooterDriver,\n },\n} satisfies ScenePart;\n\nconst dataRowLocator = byCssSelector('[role=row][data-rowindex]');\n\n/**\n * Driver for Material UI v8 DataGridPro component.\n * V8 DataGridPro component does not support data-testid, to use data-testid\n * to locate the component, you need to put the data-testid on the parent element of the grid\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridProDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n /**\n * Checks if the data grid is currently loading.\n * @returns A promise that resolves to a boolean indicating if the data grid is loading.\n */\n async isLoading(): Promise<boolean> {\n const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);\n return result.some(v => v);\n }\n\n /**\n * Waits for the data grid to exit the loading state.\n * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.\n */\n async waitForLoad(timeoutMs: number = 10000): Promise<void> {\n await this.parts.headerRow.waitUntilComponentState();\n await this.waitUntil({ probeFn: () => this.isLoading(), terminateCondition: false, timeoutMs });\n }\n\n /**\n * The number of columns currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the column count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getColumnCount(): Promise<number> {\n return this.parts.headerRow.getColumnCount();\n }\n\n /**\n * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @returns The array of text of the header row\n */\n async getHeaderText(): Promise<string[]> {\n return this.parts.headerRow.getRowText();\n }\n\n /**\n * The number of rows currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the row count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getRowCount(): Promise<number> {\n const gridRowLocator = locatorUtil.append(this.locator, dataRowLocator);\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(this, gridRowLocator, HTMLElementDriver)) {\n count++;\n }\n return count;\n }\n\n /**\n * Return the row driver for the row at the specified index, if the row does not exist, return null\n * @param rowIndex\n * @returns\n */\n async getRow(rowIndex: number): Promise<DataGridHeaderRowDriver | null> {\n const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex=\"${rowIndex}\"]`));\n const rowExists = await this.interactor.exists(rowLocator);\n if (rowExists) {\n return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n /**\n * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @param rowIndex The index of the row\n * @returns The array of text of the specified row\n */\n async getRowText(rowIndex: number): Promise<string[]> {\n const row = await this.getRow(rowIndex);\n if (row != null) {\n return row.getRowText();\n }\n throw new Error(`Row ${rowIndex} does not exist`);\n }\n\n /**\n * Get the cell driver for the cell, if the cell does not exist, return null\n * The cell driver is default to HTMLElementDriver, you can specify a different driver class\n * @param query The query to locate the cell\n * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver\n * @returns\n */\n async getCell<DriverT extends ComponentDriver>(\n query: DataGridCellQuery,\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n const rowDriver = await this.getRow(query.rowIndex);\n\n if (rowDriver === null) {\n return null;\n }\n\n if ('columnIndex' in query) {\n return rowDriver.getCell(query.columnIndex, driverClass);\n }\n\n return rowDriver.getCell(query.columnField, driverClass);\n }\n\n /**\n * Get the text content of the cell, if the cell does not exist, throw an error\n * @param query The query to locate the cell\n * @returns\n */\n async getCellText(query: DataGridCellQuery): Promise<string> {\n const cell = await this.getCell(query);\n if (cell != null) {\n const text = await cell.getText();\n return text!;\n }\n\n //@ts-ignore\n throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);\n }\n\n //#region Footer\n /**\n * Determine if the pagination footer is currently visible.\n */\n isFooterVisible(): Promise<boolean> {\n return this.parts.footer.isVisible();\n }\n\n /**\n * Check whether the \"previous page\" control is enabled.\n */\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isPreviousPageEnabled();\n }\n\n /**\n * Navigate to the previous page using the grid footer control.\n */\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoPreviousPage();\n }\n\n /**\n * Check whether the \"next page\" control is enabled.\n */\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isNextPageEnabled();\n }\n\n /**\n * Navigate to the next page using the grid footer control.\n */\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoNextPage();\n }\n\n /**\n * Read the textual description of the current pagination state.\n */\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.getText();\n }\n //#endregion Footer\n\n override get driverName(): string {\n return 'MuiV8DataGridProDriver';\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sBAAsB;;;;AAK5B,IAAsB,wBAAtB,cAAoDA,qCAAgB;CAClE,MAAgB,eAAgC;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1C,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,mBAAmB;;;;;CAM9C,MAAM,eAA8B;AAClC,QAAM,KAAK,qBAAqB,SAAS;AACzC,QAAM,KAAK,MAAM,OAAO,cAAc;;;;;CAMxC,MAAM,2BAAsD;AAC1D,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,SAAS;;CAIpC,IAAa,aAAqB;AAChC,SAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _atomic_testing_core4 from "@atomic-testing/core";
|
|
2
2
|
import { ComponentDriver, IComponentDriverOption, Interactor, Optional, PartLocator } from "@atomic-testing/core";
|
|
3
3
|
import { HTMLButtonDriver, HTMLElementDriver } from "@atomic-testing/component-driver-html";
|
|
4
4
|
|
|
@@ -58,11 +58,11 @@ declare class DataGridHeaderRowDriver extends DataGridRowDriverBase {
|
|
|
58
58
|
//#region src/components/datagrid/DataGridPaginationActionDriver.d.ts
|
|
59
59
|
declare const parts$2: {
|
|
60
60
|
previousButton: {
|
|
61
|
-
locator:
|
|
61
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
62
62
|
driver: typeof HTMLButtonDriver;
|
|
63
63
|
};
|
|
64
64
|
nextButton: {
|
|
65
|
-
locator:
|
|
65
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
66
66
|
driver: typeof HTMLButtonDriver;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
@@ -82,11 +82,11 @@ declare class DataGridPaginationActionDriver extends ComponentDriver<typeof part
|
|
|
82
82
|
//#region src/components/datagrid/DataGridFooterDriver.d.ts
|
|
83
83
|
declare const parts$1: {
|
|
84
84
|
paginationAction: {
|
|
85
|
-
locator:
|
|
85
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
86
86
|
driver: typeof DataGridPaginationActionDriver;
|
|
87
87
|
};
|
|
88
88
|
paginationDescription: {
|
|
89
|
-
locator:
|
|
89
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
90
90
|
driver: typeof HTMLElementDriver;
|
|
91
91
|
};
|
|
92
92
|
};
|
|
@@ -111,15 +111,15 @@ declare const parts: {
|
|
|
111
111
|
driver: typeof DataGridHeaderRowDriver;
|
|
112
112
|
};
|
|
113
113
|
loading: {
|
|
114
|
-
locator:
|
|
114
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
115
115
|
driver: typeof HTMLElementDriver;
|
|
116
116
|
};
|
|
117
117
|
skeletonOverlay: {
|
|
118
|
-
locator:
|
|
118
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
119
119
|
driver: typeof HTMLElementDriver;
|
|
120
120
|
};
|
|
121
121
|
footer: {
|
|
122
|
-
locator:
|
|
122
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
123
123
|
driver: typeof DataGridFooterDriver;
|
|
124
124
|
};
|
|
125
125
|
};
|
|
@@ -212,4 +212,4 @@ declare class DataGridProDriver extends ComponentDriver<typeof parts> {
|
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
|
214
214
|
export { CellQueryByColumnField, CellQueryByColumnIndex, DataGridCellQuery, DataGridDataRowDriver, DataGridHeaderRowDriver, DataGridProDriver };
|
|
215
|
-
//# sourceMappingURL=index.d.
|
|
215
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _atomic_testing_core4 from "@atomic-testing/core";
|
|
2
2
|
import { ComponentDriver, IComponentDriverOption, Interactor, Optional, PartLocator } from "@atomic-testing/core";
|
|
3
3
|
import { HTMLButtonDriver, HTMLElementDriver } from "@atomic-testing/component-driver-html";
|
|
4
4
|
|
|
@@ -58,11 +58,11 @@ declare class DataGridHeaderRowDriver extends DataGridRowDriverBase {
|
|
|
58
58
|
//#region src/components/datagrid/DataGridPaginationActionDriver.d.ts
|
|
59
59
|
declare const parts$2: {
|
|
60
60
|
previousButton: {
|
|
61
|
-
locator:
|
|
61
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
62
62
|
driver: typeof HTMLButtonDriver;
|
|
63
63
|
};
|
|
64
64
|
nextButton: {
|
|
65
|
-
locator:
|
|
65
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
66
66
|
driver: typeof HTMLButtonDriver;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
@@ -82,11 +82,11 @@ declare class DataGridPaginationActionDriver extends ComponentDriver<typeof part
|
|
|
82
82
|
//#region src/components/datagrid/DataGridFooterDriver.d.ts
|
|
83
83
|
declare const parts$1: {
|
|
84
84
|
paginationAction: {
|
|
85
|
-
locator:
|
|
85
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
86
86
|
driver: typeof DataGridPaginationActionDriver;
|
|
87
87
|
};
|
|
88
88
|
paginationDescription: {
|
|
89
|
-
locator:
|
|
89
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
90
90
|
driver: typeof HTMLElementDriver;
|
|
91
91
|
};
|
|
92
92
|
};
|
|
@@ -111,15 +111,15 @@ declare const parts: {
|
|
|
111
111
|
driver: typeof DataGridHeaderRowDriver;
|
|
112
112
|
};
|
|
113
113
|
loading: {
|
|
114
|
-
locator:
|
|
114
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
115
115
|
driver: typeof HTMLElementDriver;
|
|
116
116
|
};
|
|
117
117
|
skeletonOverlay: {
|
|
118
|
-
locator:
|
|
118
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
119
119
|
driver: typeof HTMLElementDriver;
|
|
120
120
|
};
|
|
121
121
|
footer: {
|
|
122
|
-
locator:
|
|
122
|
+
locator: _atomic_testing_core4.CssLocator;
|
|
123
123
|
driver: typeof DataGridFooterDriver;
|
|
124
124
|
};
|
|
125
125
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -37,8 +37,7 @@ var DataGridRowDriverBase = class extends ComponentDriver {
|
|
|
37
37
|
if (typeof cellIndexOrField === "number") cellLocator = byAttribute("data-colindex", cellIndexOrField.toString());
|
|
38
38
|
else cellLocator = byAttribute("data-field", cellIndexOrField);
|
|
39
39
|
const locator = locatorUtil.append(this.locator, cellLocator);
|
|
40
|
-
|
|
41
|
-
if (cellExists) return new driverClass(locator, this.interactor, this.commutableOption);
|
|
40
|
+
if (await this.interactor.exists(locator)) return new driverClass(locator, this.interactor, this.commutableOption);
|
|
42
41
|
return null;
|
|
43
42
|
}
|
|
44
43
|
};
|
|
@@ -46,7 +45,6 @@ var DataGridRowDriverBase = class extends ComponentDriver {
|
|
|
46
45
|
//#endregion
|
|
47
46
|
//#region src/components/datagrid/DataGridDataRowDriver.ts
|
|
48
47
|
var DataGridDataRowDriver = class extends DataGridRowDriverBase {
|
|
49
|
-
_dataCellLocator;
|
|
50
48
|
constructor(locator, interactor, option) {
|
|
51
49
|
super(locator, interactor, {
|
|
52
50
|
...option,
|
|
@@ -65,7 +63,6 @@ var DataGridDataRowDriver = class extends DataGridRowDriverBase {
|
|
|
65
63
|
//#endregion
|
|
66
64
|
//#region src/components/datagrid/DataGridHeaderRowDriver.ts
|
|
67
65
|
var DataGridHeaderRowDriver = class extends DataGridRowDriverBase {
|
|
68
|
-
_headerCellLocator;
|
|
69
66
|
constructor(locator, interactor, option) {
|
|
70
67
|
super(locator, interactor, {
|
|
71
68
|
...option,
|
|
@@ -109,8 +106,7 @@ var DataGridPaginationActionDriver = class extends ComponentDriver {
|
|
|
109
106
|
}
|
|
110
107
|
async isPreviousPageEnabled() {
|
|
111
108
|
await this.enforcePartExistence("previousButton");
|
|
112
|
-
|
|
113
|
-
return !isDisabled;
|
|
109
|
+
return !await this.parts.previousButton.isDisabled();
|
|
114
110
|
}
|
|
115
111
|
async gotoPreviousPage() {
|
|
116
112
|
await this.enforcePartExistence("previousButton");
|
|
@@ -118,8 +114,7 @@ var DataGridPaginationActionDriver = class extends ComponentDriver {
|
|
|
118
114
|
}
|
|
119
115
|
async isNextPageEnabled() {
|
|
120
116
|
await this.enforcePartExistence("nextButton");
|
|
121
|
-
|
|
122
|
-
return !isDisabled;
|
|
117
|
+
return !await this.parts.nextButton.isDisabled();
|
|
123
118
|
}
|
|
124
119
|
async gotoNextPage() {
|
|
125
120
|
await this.enforcePartExistence("nextButton");
|
|
@@ -217,8 +212,7 @@ var DataGridProDriver = class extends ComponentDriver {
|
|
|
217
212
|
* @returns A promise that resolves to a boolean indicating if the data grid is loading.
|
|
218
213
|
*/
|
|
219
214
|
async isLoading() {
|
|
220
|
-
|
|
221
|
-
return result.some((v) => v);
|
|
215
|
+
return (await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()])).some((v) => v);
|
|
222
216
|
}
|
|
223
217
|
/**
|
|
224
218
|
* Waits for the data grid to exit the loading state.
|
|
@@ -265,8 +259,7 @@ var DataGridProDriver = class extends ComponentDriver {
|
|
|
265
259
|
*/
|
|
266
260
|
async getRow(rowIndex) {
|
|
267
261
|
const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex="${rowIndex}"]`));
|
|
268
|
-
|
|
269
|
-
if (rowExists) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
|
|
262
|
+
if (await this.interactor.exists(rowLocator)) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
|
|
270
263
|
return null;
|
|
271
264
|
}
|
|
272
265
|
/**
|
|
@@ -299,10 +292,7 @@ var DataGridProDriver = class extends ComponentDriver {
|
|
|
299
292
|
*/
|
|
300
293
|
async getCellText(query) {
|
|
301
294
|
const cell = await this.getCell(query);
|
|
302
|
-
if (cell != null)
|
|
303
|
-
const text = await cell.getText();
|
|
304
|
-
return text;
|
|
305
|
-
}
|
|
295
|
+
if (cell != null) return await cell.getText();
|
|
306
296
|
throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);
|
|
307
297
|
}
|
|
308
298
|
/**
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["textList: string[]","cellIndexOrField: number | string","driverClass: typeof ComponentDriver","cellLocator: PartLocator","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","parts","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","parts","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","timeoutMs: number","rowIndex: number","query: DataGridCellQuery","driverClass: typeof ComponentDriver"],"sources":["../src/components/datagrid/DataGridRowDriverBase.ts","../src/components/datagrid/DataGridDataRowDriver.ts","../src/components/datagrid/DataGridHeaderRowDriver.ts","../src/components/datagrid/DataGridPaginationActionDriver.ts","../src/components/datagrid/DataGridFooterDriver.ts","../src/components/datagrid/DataGridProDriver.ts"],"sourcesContent":["import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport { byAttribute, ComponentDriver, listHelper, locatorUtil, PartLocator } from '@atomic-testing/core';\n\n// In MUI7, there is an extra div preceding the actual data cells. We need to skip it.\nconst columnStartingIndex = 1;\n\n/**\n * Base class for data grid row\n */\nexport abstract class DataGridRowDriverBase extends ComponentDriver {\n protected async getCellCount(): Promise<number> {\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n count++;\n }\n return count;\n }\n\n /**\n * Get the text of each visible cell in the row.\n * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.\n * @returns A promise array of text of each visible cell in the row\n */\n async getRowText(): Promise<string[]> {\n const textList: string[] = [];\n for await (const cell of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n const text = await cell.getText();\n textList.push(text!.trim());\n }\n return textList;\n }\n\n /**\n * Get the cell driver at the specified index or data field.\n * Caveat: Because of virtualization, the cell may not be available until the cell is visible.\n * @param cellIndexOrField number: column index, string: column field\n * @param driverClass The driver class of the cell. Default is HTMLElementDriver\n * @returns A promise of the cell driver, or null if the cell is not found\n */\n async getCell<DriverT extends ComponentDriver>(\n cellIndexOrField: number | string, // number: column index, string: column field\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n let cellLocator: PartLocator;\n if (typeof cellIndexOrField === 'number') {\n cellLocator = byAttribute('data-colindex', cellIndexOrField.toString());\n } else {\n cellLocator = byAttribute('data-field', cellIndexOrField);\n }\n const locator = locatorUtil.append(this.locator, cellLocator);\n const cellExists = await this.interactor.exists(locator);\n if (cellExists) {\n // @ts-ignore\n return new driverClass(locator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n protected abstract getCellLocator(): PartLocator;\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridDataRowDriver extends DataGridRowDriverBase {\n private readonly _dataCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._dataCellLocator = locatorUtil.append(locator, byRole('cell'));\n }\n\n protected override getCellLocator(): PartLocator {\n return this._dataCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridDataRowDriver';\n }\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridHeaderRowDriver extends DataGridRowDriverBase {\n private readonly _headerCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._headerCellLocator = locatorUtil.append(locator, byRole('columnheader'));\n }\n\n async getColumnCount(): Promise<number> {\n return this.getCellCount();\n }\n\n protected override getCellLocator(): PartLocator {\n return this._headerCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridHeaderRowDriver';\n }\n}\n","import { HTMLButtonDriver } from '@atomic-testing/component-driver-html';\nimport {\n byAttribute,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nconst parts = {\n previousButton: {\n locator: byAttribute('aria-label', 'Go to previous page'),\n driver: HTMLButtonDriver,\n },\n nextButton: {\n locator: byAttribute('aria-label', 'Go to next page'),\n driver: HTMLButtonDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridPaginationActionDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('previousButton');\n const isDisabled = await this.parts.previousButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('previousButton');\n await this.parts.previousButton.click();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('nextButton');\n const isDisabled = await this.parts.nextButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('nextButton');\n await this.parts.nextButton.click();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridPaginationActionDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridPaginationActionDriver } from './DataGridPaginationActionDriver';\n\nconst parts = {\n paginationAction: {\n locator: byCssClass('MuiTablePagination-actions'),\n driver: DataGridPaginationActionDriver,\n },\n paginationDescription: {\n locator: byCssClass('MuiTablePagination-displayedRows'),\n driver: HTMLElementDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridFooterDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isPreviousPageEnabled();\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoPreviousPage();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isNextPageEnabled();\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoNextPage();\n }\n\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('paginationDescription');\n return this.parts.paginationDescription.getText();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridFooterDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n byCssSelector,\n byRole,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n listHelper,\n locatorUtil,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridCellQuery } from './DataGridCellQuery';\nimport { DataGridFooterDriver } from './DataGridFooterDriver';\nimport { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';\n\nconst parts = {\n headerRow: {\n locator: byCssClass('MuiDataGrid-columnHeaders').chain(byCssSelector('[role=row]:first-of-type')),\n driver: DataGridHeaderRowDriver,\n },\n loading: {\n locator: byRole('progressbar'),\n driver: HTMLElementDriver,\n },\n skeletonOverlay: {\n locator: byCssClass('MuiDataGrid-main--hasSkeletonLoadingOverlay'),\n driver: HTMLElementDriver,\n },\n footer: {\n locator: byCssClass('MuiDataGrid-footerContainer'),\n driver: DataGridFooterDriver,\n },\n} satisfies ScenePart;\n\nconst dataRowLocator = byCssSelector('[role=row][data-rowindex]');\n\n/**\n * Driver for Material UI v8 DataGridPro component.\n * V8 DataGridPro component does not support data-testid, to use data-testid\n * to locate the component, you need to put the data-testid on the parent element of the grid\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridProDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n /**\n * Checks if the data grid is currently loading.\n * @returns A promise that resolves to a boolean indicating if the data grid is loading.\n */\n async isLoading(): Promise<boolean> {\n const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);\n return result.some(v => v);\n }\n\n /**\n * Waits for the data grid to exit the loading state.\n * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.\n */\n async waitForLoad(timeoutMs: number = 10000): Promise<void> {\n await this.parts.headerRow.waitUntilComponentState();\n await this.waitUntil({ probeFn: () => this.isLoading(), terminateCondition: false, timeoutMs });\n }\n\n /**\n * The number of columns currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the column count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getColumnCount(): Promise<number> {\n return this.parts.headerRow.getColumnCount();\n }\n\n /**\n * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @returns The array of text of the header row\n */\n async getHeaderText(): Promise<string[]> {\n return this.parts.headerRow.getRowText();\n }\n\n /**\n * The number of rows currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the row count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getRowCount(): Promise<number> {\n const gridRowLocator = locatorUtil.append(this.locator, dataRowLocator);\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(this, gridRowLocator, HTMLElementDriver)) {\n count++;\n }\n return count;\n }\n\n /**\n * Return the row driver for the row at the specified index, if the row does not exist, return null\n * @param rowIndex\n * @returns\n */\n async getRow(rowIndex: number): Promise<DataGridHeaderRowDriver | null> {\n const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex=\"${rowIndex}\"]`));\n const rowExists = await this.interactor.exists(rowLocator);\n if (rowExists) {\n return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n /**\n * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @param rowIndex The index of the row\n * @returns The array of text of the specified row\n */\n async getRowText(rowIndex: number): Promise<string[]> {\n const row = await this.getRow(rowIndex);\n if (row != null) {\n return row.getRowText();\n }\n throw new Error(`Row ${rowIndex} does not exist`);\n }\n\n /**\n * Get the cell driver for the cell, if the cell does not exist, return null\n * The cell driver is default to HTMLElementDriver, you can specify a different driver class\n * @param query The query to locate the cell\n * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver\n * @returns\n */\n async getCell<DriverT extends ComponentDriver>(\n query: DataGridCellQuery,\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n const rowDriver = await this.getRow(query.rowIndex);\n\n if (rowDriver === null) {\n return null;\n }\n\n if ('columnIndex' in query) {\n return rowDriver.getCell(query.columnIndex, driverClass);\n }\n\n return rowDriver.getCell(query.columnField, driverClass);\n }\n\n /**\n * Get the text content of the cell, if the cell does not exist, throw an error\n * @param query The query to locate the cell\n * @returns\n */\n async getCellText(query: DataGridCellQuery): Promise<string> {\n const cell = await this.getCell(query);\n if (cell != null) {\n const text = await cell.getText();\n return text!;\n }\n\n //@ts-ignore\n throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);\n }\n\n //#region Footer\n /**\n * Determine if the pagination footer is currently visible.\n */\n isFooterVisible(): Promise<boolean> {\n return this.parts.footer.isVisible();\n }\n\n /**\n * Check whether the \"previous page\" control is enabled.\n */\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isPreviousPageEnabled();\n }\n\n /**\n * Navigate to the previous page using the grid footer control.\n */\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoPreviousPage();\n }\n\n /**\n * Check whether the \"next page\" control is enabled.\n */\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isNextPageEnabled();\n }\n\n /**\n * Navigate to the next page using the grid footer control.\n */\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoNextPage();\n }\n\n /**\n * Read the textual description of the current pagination state.\n */\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.getText();\n }\n //#endregion Footer\n\n override get driverName(): string {\n return 'MuiV8DataGridProDriver';\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sBAAsB;;;;AAK5B,IAAsB,wBAAtB,cAAoD,gBAAgB;CAClE,MAAgB,eAAgC;EAC9C,IAAI,QAAQ;AACZ,aAAW,MAAM,KAAK,WAAW,oBAC/B,MACA,KAAK,gBAAgB,EACrB,mBACA,oBACD,CACC;AAEF,SAAO;CACR;;;;;;CAOD,MAAM,aAAgC;EACpC,MAAMA,WAAqB,CAAE;AAC7B,aAAW,MAAM,QAAQ,WAAW,oBAClC,MACA,KAAK,gBAAgB,EACrB,mBACA,oBACD,EAAE;GACD,MAAM,OAAO,MAAM,KAAK,SAAS;AACjC,YAAS,KAAK,KAAM,MAAM,CAAC;EAC5B;AACD,SAAO;CACR;;;;;;;;CASD,MAAM,QACJC,kBAEAC,cAAsC,mBACb;EACzB,IAAIC;AACJ,aAAW,qBAAqB,SAC9B,eAAc,YAAY,iBAAiB,iBAAiB,UAAU,CAAC;MAEvE,eAAc,YAAY,cAAc,iBAAiB;EAE3D,MAAM,UAAU,YAAY,OAAO,KAAK,SAAS,YAAY;E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;CAGD,IAAa,aAAqB;AAChC,SAAO;CACR;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["textList: string[]","cellLocator: PartLocator","parts","parts"],"sources":["../src/components/datagrid/DataGridRowDriverBase.ts","../src/components/datagrid/DataGridDataRowDriver.ts","../src/components/datagrid/DataGridHeaderRowDriver.ts","../src/components/datagrid/DataGridPaginationActionDriver.ts","../src/components/datagrid/DataGridFooterDriver.ts","../src/components/datagrid/DataGridProDriver.ts"],"sourcesContent":["import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport { byAttribute, ComponentDriver, listHelper, locatorUtil, PartLocator } from '@atomic-testing/core';\n\n// In MUI7, there is an extra div preceding the actual data cells. We need to skip it.\nconst columnStartingIndex = 1;\n\n/**\n * Base class for data grid row\n */\nexport abstract class DataGridRowDriverBase extends ComponentDriver {\n protected async getCellCount(): Promise<number> {\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n count++;\n }\n return count;\n }\n\n /**\n * Get the text of each visible cell in the row.\n * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.\n * @returns A promise array of text of each visible cell in the row\n */\n async getRowText(): Promise<string[]> {\n const textList: string[] = [];\n for await (const cell of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n const text = await cell.getText();\n textList.push(text!.trim());\n }\n return textList;\n }\n\n /**\n * Get the cell driver at the specified index or data field.\n * Caveat: Because of virtualization, the cell may not be available until the cell is visible.\n * @param cellIndexOrField number: column index, string: column field\n * @param driverClass The driver class of the cell. Default is HTMLElementDriver\n * @returns A promise of the cell driver, or null if the cell is not found\n */\n async getCell<DriverT extends ComponentDriver>(\n cellIndexOrField: number | string, // number: column index, string: column field\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n let cellLocator: PartLocator;\n if (typeof cellIndexOrField === 'number') {\n cellLocator = byAttribute('data-colindex', cellIndexOrField.toString());\n } else {\n cellLocator = byAttribute('data-field', cellIndexOrField);\n }\n const locator = locatorUtil.append(this.locator, cellLocator);\n const cellExists = await this.interactor.exists(locator);\n if (cellExists) {\n // @ts-ignore\n return new driverClass(locator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n protected abstract getCellLocator(): PartLocator;\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridDataRowDriver extends DataGridRowDriverBase {\n private readonly _dataCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._dataCellLocator = locatorUtil.append(locator, byRole('cell'));\n }\n\n protected override getCellLocator(): PartLocator {\n return this._dataCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridDataRowDriver';\n }\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridHeaderRowDriver extends DataGridRowDriverBase {\n private readonly _headerCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._headerCellLocator = locatorUtil.append(locator, byRole('columnheader'));\n }\n\n async getColumnCount(): Promise<number> {\n return this.getCellCount();\n }\n\n protected override getCellLocator(): PartLocator {\n return this._headerCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridHeaderRowDriver';\n }\n}\n","import { HTMLButtonDriver } from '@atomic-testing/component-driver-html';\nimport {\n byAttribute,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nconst parts = {\n previousButton: {\n locator: byAttribute('aria-label', 'Go to previous page'),\n driver: HTMLButtonDriver,\n },\n nextButton: {\n locator: byAttribute('aria-label', 'Go to next page'),\n driver: HTMLButtonDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridPaginationActionDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('previousButton');\n const isDisabled = await this.parts.previousButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('previousButton');\n await this.parts.previousButton.click();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('nextButton');\n const isDisabled = await this.parts.nextButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('nextButton');\n await this.parts.nextButton.click();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridPaginationActionDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridPaginationActionDriver } from './DataGridPaginationActionDriver';\n\nconst parts = {\n paginationAction: {\n locator: byCssClass('MuiTablePagination-actions'),\n driver: DataGridPaginationActionDriver,\n },\n paginationDescription: {\n locator: byCssClass('MuiTablePagination-displayedRows'),\n driver: HTMLElementDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridFooterDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isPreviousPageEnabled();\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoPreviousPage();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isNextPageEnabled();\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoNextPage();\n }\n\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('paginationDescription');\n return this.parts.paginationDescription.getText();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridFooterDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n byCssSelector,\n byRole,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n listHelper,\n locatorUtil,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridCellQuery } from './DataGridCellQuery';\nimport { DataGridFooterDriver } from './DataGridFooterDriver';\nimport { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';\n\nconst parts = {\n headerRow: {\n locator: byCssClass('MuiDataGrid-columnHeaders').chain(byCssSelector('[role=row]:first-of-type')),\n driver: DataGridHeaderRowDriver,\n },\n loading: {\n locator: byRole('progressbar'),\n driver: HTMLElementDriver,\n },\n skeletonOverlay: {\n locator: byCssClass('MuiDataGrid-main--hasSkeletonLoadingOverlay'),\n driver: HTMLElementDriver,\n },\n footer: {\n locator: byCssClass('MuiDataGrid-footerContainer'),\n driver: DataGridFooterDriver,\n },\n} satisfies ScenePart;\n\nconst dataRowLocator = byCssSelector('[role=row][data-rowindex]');\n\n/**\n * Driver for Material UI v8 DataGridPro component.\n * V8 DataGridPro component does not support data-testid, to use data-testid\n * to locate the component, you need to put the data-testid on the parent element of the grid\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridProDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n /**\n * Checks if the data grid is currently loading.\n * @returns A promise that resolves to a boolean indicating if the data grid is loading.\n */\n async isLoading(): Promise<boolean> {\n const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);\n return result.some(v => v);\n }\n\n /**\n * Waits for the data grid to exit the loading state.\n * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.\n */\n async waitForLoad(timeoutMs: number = 10000): Promise<void> {\n await this.parts.headerRow.waitUntilComponentState();\n await this.waitUntil({ probeFn: () => this.isLoading(), terminateCondition: false, timeoutMs });\n }\n\n /**\n * The number of columns currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the column count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getColumnCount(): Promise<number> {\n return this.parts.headerRow.getColumnCount();\n }\n\n /**\n * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @returns The array of text of the header row\n */\n async getHeaderText(): Promise<string[]> {\n return this.parts.headerRow.getRowText();\n }\n\n /**\n * The number of rows currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the row count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getRowCount(): Promise<number> {\n const gridRowLocator = locatorUtil.append(this.locator, dataRowLocator);\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(this, gridRowLocator, HTMLElementDriver)) {\n count++;\n }\n return count;\n }\n\n /**\n * Return the row driver for the row at the specified index, if the row does not exist, return null\n * @param rowIndex\n * @returns\n */\n async getRow(rowIndex: number): Promise<DataGridHeaderRowDriver | null> {\n const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex=\"${rowIndex}\"]`));\n const rowExists = await this.interactor.exists(rowLocator);\n if (rowExists) {\n return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n /**\n * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @param rowIndex The index of the row\n * @returns The array of text of the specified row\n */\n async getRowText(rowIndex: number): Promise<string[]> {\n const row = await this.getRow(rowIndex);\n if (row != null) {\n return row.getRowText();\n }\n throw new Error(`Row ${rowIndex} does not exist`);\n }\n\n /**\n * Get the cell driver for the cell, if the cell does not exist, return null\n * The cell driver is default to HTMLElementDriver, you can specify a different driver class\n * @param query The query to locate the cell\n * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver\n * @returns\n */\n async getCell<DriverT extends ComponentDriver>(\n query: DataGridCellQuery,\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n const rowDriver = await this.getRow(query.rowIndex);\n\n if (rowDriver === null) {\n return null;\n }\n\n if ('columnIndex' in query) {\n return rowDriver.getCell(query.columnIndex, driverClass);\n }\n\n return rowDriver.getCell(query.columnField, driverClass);\n }\n\n /**\n * Get the text content of the cell, if the cell does not exist, throw an error\n * @param query The query to locate the cell\n * @returns\n */\n async getCellText(query: DataGridCellQuery): Promise<string> {\n const cell = await this.getCell(query);\n if (cell != null) {\n const text = await cell.getText();\n return text!;\n }\n\n //@ts-ignore\n throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);\n }\n\n //#region Footer\n /**\n * Determine if the pagination footer is currently visible.\n */\n isFooterVisible(): Promise<boolean> {\n return this.parts.footer.isVisible();\n }\n\n /**\n * Check whether the \"previous page\" control is enabled.\n */\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isPreviousPageEnabled();\n }\n\n /**\n * Navigate to the previous page using the grid footer control.\n */\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoPreviousPage();\n }\n\n /**\n * Check whether the \"next page\" control is enabled.\n */\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isNextPageEnabled();\n }\n\n /**\n * Navigate to the next page using the grid footer control.\n */\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoNextPage();\n }\n\n /**\n * Read the textual description of the current pagination state.\n */\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.getText();\n }\n //#endregion Footer\n\n override get driverName(): string {\n return 'MuiV8DataGridProDriver';\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sBAAsB;;;;AAK5B,IAAsB,wBAAtB,cAAoD,gBAAgB;CAClE,MAAgB,eAAgC;EAC9C,IAAI,QAAQ;AACZ,aAAW,MAAM,KAAK,WAAW,oBAC/B,MACA,KAAK,gBAAgB,EACrB,mBACA,oBACD,CACC;AAEF,SAAO;;;;;;;CAQT,MAAM,aAAgC;EACpC,MAAMA,WAAqB,EAAE;AAC7B,aAAW,MAAM,QAAQ,WAAW,oBAClC,MACA,KAAK,gBAAgB,EACrB,mBACA,oBACD,EAAE;GACD,MAAM,OAAO,MAAM,KAAK,SAAS;AACjC,YAAS,KAAK,KAAM,MAAM,CAAC;;AAE7B,SAAO;;;;;;;;;CAUT,MAAM,QACJ,kBAEA,cAAsC,mBACb;EACzB,IAAIC;AACJ,MAAI,OAAO,qBAAqB,SAC9B,eAAc,YAAY,iBAAiB,iBAAiB,UAAU,CAAC;MAEvE,eAAc,YAAY,cAAc,iBAAiB;EAE3D,MAAM,UAAU,YAAY,OAAO,KAAK,SAAS,YAAY;AAE7D,MADmB,MAAM,KAAK,WAAW,OAAO,QAAQ,CAGtD,QAAO,IAAI,YAAY,SAAS,KAAK,YAAY,KAAK,iBAAiB;AAGzE,SAAO;;;;;;AC/DX,IAAa,wBAAb,cAA2C,sBAAsB;CAE/D,YAAY,SAAsB,YAAwB,QAA0C;AAClG,QAAM,SAAS,YAAY;GACzB,GAAG;GACH,OAAO,EA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,OAA2C;EAC3D,MAAM,OAAO,MAAM,KAAK,QAAQ,MAAM;AACtC,MAAI,QAAQ,KAEV,QADa,MAAM,KAAK,SAAS;AAKnC,QAAM,IAAI,MAAM,eAAe,MAAM,SAAS,UAAU,MAAM,eAAe,MAAM,YAAY,iBAAiB;;;;;CAOlH,kBAAoC;AAClC,SAAO,KAAK,MAAM,OAAO,WAAW;;;;;CAMtC,MAAM,wBAA0C;AAC9C,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,uBAAuB;;;;;CAMlD,MAAM,mBAAkC;AACtC,QAAM,KAAK,qBAAqB,SAAS;AACzC,QAAM,KAAK,MAAM,OAAO,kBAAkB;;;;;CAM5C,MAAM,oBAAsC;AAC1C,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,mBAAmB;;;;;CAM9C,MAAM,eAA8B;AAClC,QAAM,KAAK,qBAAqB,SAAS;AACzC,QAAM,KAAK,MAAM,OAAO,cAAc;;;;;CAMxC,MAAM,2BAAsD;AAC1D,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,SAAS;;CAIpC,IAAa,aAAqB;AAChC,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-testing/component-driver-mui-x-v8",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.0",
|
|
4
4
|
"description": "Atomic Testing Component driver to help drive Material UI X V8 components",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.
|
|
7
|
+
"types": "dist/index.d.cts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"src"
|
|
@@ -27,9 +27,16 @@
|
|
|
27
27
|
"directory": "packages/component-driver-mui-x-v8"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atomic-testing/core": "0.
|
|
31
|
-
"@atomic-testing/component-driver-mui-v6": "0.
|
|
32
|
-
"@atomic-testing/component-driver-html": "0.
|
|
30
|
+
"@atomic-testing/core": "0.79.0",
|
|
31
|
+
"@atomic-testing/component-driver-mui-v6": "0.79.0",
|
|
32
|
+
"@atomic-testing/component-driver-html": "0.79.0"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.mts",
|
|
37
|
+
"import": "./dist/index.mjs",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
39
|
+
}
|
|
33
40
|
},
|
|
34
41
|
"scripts": {
|
|
35
42
|
"build": "tsdown",
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentDriver","HTMLElementDriver","textList: string[]","cellIndexOrField: number | string","driverClass: typeof ComponentDriver","cellLocator: PartLocator","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","parts","HTMLButtonDriver","ComponentDriver","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","parts","HTMLElementDriver","ComponentDriver","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","HTMLElementDriver","ComponentDriver","locator: PartLocator","interactor: Interactor","option?: Partial<IComponentDriverOption>","timeoutMs: number","rowIndex: number","query: DataGridCellQuery","driverClass: typeof ComponentDriver"],"sources":["../src/components/datagrid/DataGridRowDriverBase.ts","../src/components/datagrid/DataGridDataRowDriver.ts","../src/components/datagrid/DataGridHeaderRowDriver.ts","../src/components/datagrid/DataGridPaginationActionDriver.ts","../src/components/datagrid/DataGridFooterDriver.ts","../src/components/datagrid/DataGridProDriver.ts"],"sourcesContent":["import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport { byAttribute, ComponentDriver, listHelper, locatorUtil, PartLocator } from '@atomic-testing/core';\n\n// In MUI7, there is an extra div preceding the actual data cells. We need to skip it.\nconst columnStartingIndex = 1;\n\n/**\n * Base class for data grid row\n */\nexport abstract class DataGridRowDriverBase extends ComponentDriver {\n protected async getCellCount(): Promise<number> {\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n count++;\n }\n return count;\n }\n\n /**\n * Get the text of each visible cell in the row.\n * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.\n * @returns A promise array of text of each visible cell in the row\n */\n async getRowText(): Promise<string[]> {\n const textList: string[] = [];\n for await (const cell of listHelper.getListItemIterator(\n this,\n this.getCellLocator(),\n HTMLElementDriver,\n columnStartingIndex\n )) {\n const text = await cell.getText();\n textList.push(text!.trim());\n }\n return textList;\n }\n\n /**\n * Get the cell driver at the specified index or data field.\n * Caveat: Because of virtualization, the cell may not be available until the cell is visible.\n * @param cellIndexOrField number: column index, string: column field\n * @param driverClass The driver class of the cell. Default is HTMLElementDriver\n * @returns A promise of the cell driver, or null if the cell is not found\n */\n async getCell<DriverT extends ComponentDriver>(\n cellIndexOrField: number | string, // number: column index, string: column field\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n let cellLocator: PartLocator;\n if (typeof cellIndexOrField === 'number') {\n cellLocator = byAttribute('data-colindex', cellIndexOrField.toString());\n } else {\n cellLocator = byAttribute('data-field', cellIndexOrField);\n }\n const locator = locatorUtil.append(this.locator, cellLocator);\n const cellExists = await this.interactor.exists(locator);\n if (cellExists) {\n // @ts-ignore\n return new driverClass(locator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n protected abstract getCellLocator(): PartLocator;\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridDataRowDriver extends DataGridRowDriverBase {\n private readonly _dataCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._dataCellLocator = locatorUtil.append(locator, byRole('cell'));\n }\n\n protected override getCellLocator(): PartLocator {\n return this._dataCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridDataRowDriver';\n }\n}\n","import { byRole, IComponentDriverOption, Interactor, locatorUtil, PartLocator } from '@atomic-testing/core';\n\nimport { DataGridRowDriverBase } from './DataGridRowDriverBase';\n\nexport class DataGridHeaderRowDriver extends DataGridRowDriverBase {\n private readonly _headerCellLocator: PartLocator;\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts: {},\n });\n\n this._headerCellLocator = locatorUtil.append(locator, byRole('columnheader'));\n }\n\n async getColumnCount(): Promise<number> {\n return this.getCellCount();\n }\n\n protected override getCellLocator(): PartLocator {\n return this._headerCellLocator;\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridHeaderRowDriver';\n }\n}\n","import { HTMLButtonDriver } from '@atomic-testing/component-driver-html';\nimport {\n byAttribute,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nconst parts = {\n previousButton: {\n locator: byAttribute('aria-label', 'Go to previous page'),\n driver: HTMLButtonDriver,\n },\n nextButton: {\n locator: byAttribute('aria-label', 'Go to next page'),\n driver: HTMLButtonDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridPaginationActionDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('previousButton');\n const isDisabled = await this.parts.previousButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('previousButton');\n await this.parts.previousButton.click();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('nextButton');\n const isDisabled = await this.parts.nextButton.isDisabled();\n return !isDisabled;\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('nextButton');\n await this.parts.nextButton.click();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridPaginationActionDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridPaginationActionDriver } from './DataGridPaginationActionDriver';\n\nconst parts = {\n paginationAction: {\n locator: byCssClass('MuiTablePagination-actions'),\n driver: DataGridPaginationActionDriver,\n },\n paginationDescription: {\n locator: byCssClass('MuiTablePagination-displayedRows'),\n driver: HTMLElementDriver,\n },\n} satisfies ScenePart;\n\n/**\n * Driver for Material UI v6 DataGridPro component.\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridFooterDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isPreviousPageEnabled();\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoPreviousPage();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('paginationAction');\n return this.parts.paginationAction.isNextPageEnabled();\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('paginationAction');\n await this.parts.paginationAction.gotoNextPage();\n }\n\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('paginationDescription');\n return this.parts.paginationDescription.getText();\n }\n\n override get driverName(): string {\n return 'MuiV8DataGridFooterDriver';\n }\n}\n","import { HTMLElementDriver } from '@atomic-testing/component-driver-html';\nimport {\n byCssClass,\n byCssSelector,\n byRole,\n ComponentDriver,\n IComponentDriverOption,\n Interactor,\n listHelper,\n locatorUtil,\n Optional,\n PartLocator,\n ScenePart,\n} from '@atomic-testing/core';\n\nimport { DataGridCellQuery } from './DataGridCellQuery';\nimport { DataGridFooterDriver } from './DataGridFooterDriver';\nimport { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';\n\nconst parts = {\n headerRow: {\n locator: byCssClass('MuiDataGrid-columnHeaders').chain(byCssSelector('[role=row]:first-of-type')),\n driver: DataGridHeaderRowDriver,\n },\n loading: {\n locator: byRole('progressbar'),\n driver: HTMLElementDriver,\n },\n skeletonOverlay: {\n locator: byCssClass('MuiDataGrid-main--hasSkeletonLoadingOverlay'),\n driver: HTMLElementDriver,\n },\n footer: {\n locator: byCssClass('MuiDataGrid-footerContainer'),\n driver: DataGridFooterDriver,\n },\n} satisfies ScenePart;\n\nconst dataRowLocator = byCssSelector('[role=row][data-rowindex]');\n\n/**\n * Driver for Material UI v8 DataGridPro component.\n * V8 DataGridPro component does not support data-testid, to use data-testid\n * to locate the component, you need to put the data-testid on the parent element of the grid\n * @see https://mui.com/x/react-data-grid/\n */\nexport class DataGridProDriver extends ComponentDriver<typeof parts> {\n constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>) {\n super(locator, interactor, {\n ...option,\n parts,\n });\n }\n\n /**\n * Checks if the data grid is currently loading.\n * @returns A promise that resolves to a boolean indicating if the data grid is loading.\n */\n async isLoading(): Promise<boolean> {\n const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);\n return result.some(v => v);\n }\n\n /**\n * Waits for the data grid to exit the loading state.\n * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.\n */\n async waitForLoad(timeoutMs: number = 10000): Promise<void> {\n await this.parts.headerRow.waitUntilComponentState();\n await this.waitUntil({ probeFn: () => this.isLoading(), terminateCondition: false, timeoutMs });\n }\n\n /**\n * The number of columns currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the column count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getColumnCount(): Promise<number> {\n return this.parts.headerRow.getColumnCount();\n }\n\n /**\n * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @returns The array of text of the header row\n */\n async getHeaderText(): Promise<string[]> {\n return this.parts.headerRow.getRowText();\n }\n\n /**\n * The number of rows currently displayed in the data grid, note that data grid pro\n * uses virtualize rendering, therefore the row count heavily depends on the viewport size\n * @returns The number of columns currently displayed in the data grid\n */\n async getRowCount(): Promise<number> {\n const gridRowLocator = locatorUtil.append(this.locator, dataRowLocator);\n let count = 0;\n for await (const _ of listHelper.getListItemIterator(this, gridRowLocator, HTMLElementDriver)) {\n count++;\n }\n return count;\n }\n\n /**\n * Return the row driver for the row at the specified index, if the row does not exist, return null\n * @param rowIndex\n * @returns\n */\n async getRow(rowIndex: number): Promise<DataGridHeaderRowDriver | null> {\n const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex=\"${rowIndex}\"]`));\n const rowExists = await this.interactor.exists(rowLocator);\n if (rowExists) {\n return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);\n }\n\n return null;\n }\n\n /**\n * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering\n * @param rowIndex The index of the row\n * @returns The array of text of the specified row\n */\n async getRowText(rowIndex: number): Promise<string[]> {\n const row = await this.getRow(rowIndex);\n if (row != null) {\n return row.getRowText();\n }\n throw new Error(`Row ${rowIndex} does not exist`);\n }\n\n /**\n * Get the cell driver for the cell, if the cell does not exist, return null\n * The cell driver is default to HTMLElementDriver, you can specify a different driver class\n * @param query The query to locate the cell\n * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver\n * @returns\n */\n async getCell<DriverT extends ComponentDriver>(\n query: DataGridCellQuery,\n // @ts-ignore\n driverClass: typeof ComponentDriver = HTMLElementDriver\n ): Promise<DriverT | null> {\n const rowDriver = await this.getRow(query.rowIndex);\n\n if (rowDriver === null) {\n return null;\n }\n\n if ('columnIndex' in query) {\n return rowDriver.getCell(query.columnIndex, driverClass);\n }\n\n return rowDriver.getCell(query.columnField, driverClass);\n }\n\n /**\n * Get the text content of the cell, if the cell does not exist, throw an error\n * @param query The query to locate the cell\n * @returns\n */\n async getCellText(query: DataGridCellQuery): Promise<string> {\n const cell = await this.getCell(query);\n if (cell != null) {\n const text = await cell.getText();\n return text!;\n }\n\n //@ts-ignore\n throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);\n }\n\n //#region Footer\n /**\n * Determine if the pagination footer is currently visible.\n */\n isFooterVisible(): Promise<boolean> {\n return this.parts.footer.isVisible();\n }\n\n /**\n * Check whether the \"previous page\" control is enabled.\n */\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isPreviousPageEnabled();\n }\n\n /**\n * Navigate to the previous page using the grid footer control.\n */\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoPreviousPage();\n }\n\n /**\n * Check whether the \"next page\" control is enabled.\n */\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isNextPageEnabled();\n }\n\n /**\n * Navigate to the next page using the grid footer control.\n */\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoNextPage();\n }\n\n /**\n * Read the textual description of the current pagination state.\n */\n async getPaginationDescription(): Promise<Optional<string>> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.getText();\n }\n //#endregion Footer\n\n override get driverName(): string {\n return 'MuiV8DataGridProDriver';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAI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