@atomic-testing/component-driver-mui-x-v8 0.58.0 → 0.59.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.
Files changed (31) hide show
  1. package/dist/index.d.mts +199 -0
  2. package/dist/index.d.ts +199 -1
  3. package/dist/index.js +362 -17
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +338 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +7 -7
  8. package/dist/components/datagrid/DataGridCellQuery.d.ts +0 -9
  9. package/dist/components/datagrid/DataGridCellQuery.js +0 -3
  10. package/dist/components/datagrid/DataGridCellQuery.js.map +0 -1
  11. package/dist/components/datagrid/DataGridDataRowDriver.d.ts +0 -8
  12. package/dist/components/datagrid/DataGridDataRowDriver.js +0 -19
  13. package/dist/components/datagrid/DataGridDataRowDriver.js.map +0 -1
  14. package/dist/components/datagrid/DataGridFooterDriver.d.ts +0 -27
  15. package/dist/components/datagrid/DataGridFooterDriver.js +0 -69
  16. package/dist/components/datagrid/DataGridFooterDriver.js.map +0 -1
  17. package/dist/components/datagrid/DataGridHeaderRowDriver.d.ts +0 -9
  18. package/dist/components/datagrid/DataGridHeaderRowDriver.js +0 -33
  19. package/dist/components/datagrid/DataGridHeaderRowDriver.js.map +0 -1
  20. package/dist/components/datagrid/DataGridPaginationActionDriver.d.ts +0 -25
  21. package/dist/components/datagrid/DataGridPaginationActionDriver.js +0 -64
  22. package/dist/components/datagrid/DataGridPaginationActionDriver.js.map +0 -1
  23. package/dist/components/datagrid/DataGridProDriver.d.ts +0 -93
  24. package/dist/components/datagrid/DataGridProDriver.js +0 -227
  25. package/dist/components/datagrid/DataGridProDriver.js.map +0 -1
  26. package/dist/components/datagrid/DataGridRowDriverBase.d.ts +0 -23
  27. package/dist/components/datagrid/DataGridRowDriverBase.js +0 -107
  28. package/dist/components/datagrid/DataGridRowDriverBase.js.map +0 -1
  29. package/dist/components/datagrid/index.d.ts +0 -4
  30. package/dist/components/datagrid/index.js +0 -25
  31. package/dist/components/datagrid/index.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,18 +1,363 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components/datagrid"), exports);
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
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"));
26
+
27
+ //#region src/components/datagrid/DataGridRowDriverBase.ts
28
+ const columnStartingIndex = 1;
29
+ /**
30
+ * Base class for data grid row
31
+ */
32
+ var DataGridRowDriverBase = class extends __atomic_testing_core.ComponentDriver {
33
+ async getCellCount() {
34
+ let count = 0;
35
+ for await (const _ of __atomic_testing_core.listHelper.getListItemIterator(this, this.getCellLocator(), __atomic_testing_component_driver_html.HTMLElementDriver, columnStartingIndex)) count++;
36
+ return count;
37
+ }
38
+ /**
39
+ * Get the text of each visible cell in the row.
40
+ * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.
41
+ * @returns A promise array of text of each visible cell in the row
42
+ */
43
+ async getRowText() {
44
+ const textList = [];
45
+ for await (const cell of __atomic_testing_core.listHelper.getListItemIterator(this, this.getCellLocator(), __atomic_testing_component_driver_html.HTMLElementDriver, columnStartingIndex)) {
46
+ const text = await cell.getText();
47
+ textList.push(text.trim());
48
+ }
49
+ return textList;
50
+ }
51
+ /**
52
+ * Get the cell driver at the specified index or data field.
53
+ * Caveat: Because of virtualization, the cell may not be available until the cell is visible.
54
+ * @param cellIndexOrField number: column index, string: column field
55
+ * @param driverClass The driver class of the cell. Default is HTMLElementDriver
56
+ * @returns A promise of the cell driver, or null if the cell is not found
57
+ */
58
+ async getCell(cellIndexOrField, driverClass = __atomic_testing_component_driver_html.HTMLElementDriver) {
59
+ let cellLocator;
60
+ if (typeof cellIndexOrField === "number") cellLocator = (0, __atomic_testing_core.byAttribute)("data-colindex", cellIndexOrField.toString());
61
+ else cellLocator = (0, __atomic_testing_core.byAttribute)("data-field", cellIndexOrField);
62
+ const locator = __atomic_testing_core.locatorUtil.append(this.locator, cellLocator);
63
+ const cellExists = await this.interactor.exists(locator);
64
+ if (cellExists) return new driverClass(locator, this.interactor, this.commutableOption);
65
+ return null;
66
+ }
67
+ };
68
+
69
+ //#endregion
70
+ //#region src/components/datagrid/DataGridDataRowDriver.ts
71
+ var DataGridDataRowDriver = class extends DataGridRowDriverBase {
72
+ _dataCellLocator;
73
+ constructor(locator, interactor, option) {
74
+ super(locator, interactor, {
75
+ ...option,
76
+ parts: {}
77
+ });
78
+ this._dataCellLocator = __atomic_testing_core.locatorUtil.append(locator, (0, __atomic_testing_core.byRole)("cell"));
79
+ }
80
+ getCellLocator() {
81
+ return this._dataCellLocator;
82
+ }
83
+ get driverName() {
84
+ return "MuiV8DataGridDataRowDriver";
85
+ }
86
+ };
87
+
88
+ //#endregion
89
+ //#region src/components/datagrid/DataGridHeaderRowDriver.ts
90
+ var DataGridHeaderRowDriver = class extends DataGridRowDriverBase {
91
+ _headerCellLocator;
92
+ constructor(locator, interactor, option) {
93
+ super(locator, interactor, {
94
+ ...option,
95
+ parts: {}
96
+ });
97
+ this._headerCellLocator = __atomic_testing_core.locatorUtil.append(locator, (0, __atomic_testing_core.byRole)("columnheader"));
98
+ }
99
+ async getColumnCount() {
100
+ return this.getCellCount();
101
+ }
102
+ getCellLocator() {
103
+ return this._headerCellLocator;
104
+ }
105
+ get driverName() {
106
+ return "MuiV8DataGridHeaderRowDriver";
107
+ }
108
+ };
109
+
110
+ //#endregion
111
+ //#region src/components/datagrid/DataGridPaginationActionDriver.ts
112
+ const parts$2 = {
113
+ previousButton: {
114
+ locator: (0, __atomic_testing_core.byAttribute)("aria-label", "Go to previous page"),
115
+ driver: __atomic_testing_component_driver_html.HTMLButtonDriver
116
+ },
117
+ nextButton: {
118
+ locator: (0, __atomic_testing_core.byAttribute)("aria-label", "Go to next page"),
119
+ driver: __atomic_testing_component_driver_html.HTMLButtonDriver
120
+ }
121
+ };
122
+ /**
123
+ * Driver for Material UI v6 DataGridPro component.
124
+ * @see https://mui.com/x/react-data-grid/
125
+ */
126
+ var DataGridPaginationActionDriver = class extends __atomic_testing_core.ComponentDriver {
127
+ constructor(locator, interactor, option) {
128
+ super(locator, interactor, {
129
+ ...option,
130
+ parts: parts$2
131
+ });
132
+ }
133
+ async isPreviousPageEnabled() {
134
+ await this.enforcePartExistence("previousButton");
135
+ const isDisabled = await this.parts.previousButton.isDisabled();
136
+ return !isDisabled;
137
+ }
138
+ async gotoPreviousPage() {
139
+ await this.enforcePartExistence("previousButton");
140
+ await this.parts.previousButton.click();
141
+ }
142
+ async isNextPageEnabled() {
143
+ await this.enforcePartExistence("nextButton");
144
+ const isDisabled = await this.parts.nextButton.isDisabled();
145
+ return !isDisabled;
146
+ }
147
+ async gotoNextPage() {
148
+ await this.enforcePartExistence("nextButton");
149
+ await this.parts.nextButton.click();
150
+ }
151
+ get driverName() {
152
+ return "MuiV8DataGridPaginationActionDriver";
153
+ }
154
+ };
155
+
156
+ //#endregion
157
+ //#region src/components/datagrid/DataGridFooterDriver.ts
158
+ const parts$1 = {
159
+ paginationAction: {
160
+ locator: (0, __atomic_testing_core.byCssClass)("MuiTablePagination-actions"),
161
+ driver: DataGridPaginationActionDriver
162
+ },
163
+ paginationDescription: {
164
+ locator: (0, __atomic_testing_core.byCssClass)("MuiTablePagination-displayedRows"),
165
+ driver: __atomic_testing_component_driver_html.HTMLElementDriver
166
+ }
167
+ };
168
+ /**
169
+ * Driver for Material UI v6 DataGridPro component.
170
+ * @see https://mui.com/x/react-data-grid/
171
+ */
172
+ var DataGridFooterDriver = class extends __atomic_testing_core.ComponentDriver {
173
+ constructor(locator, interactor, option) {
174
+ super(locator, interactor, {
175
+ ...option,
176
+ parts: parts$1
177
+ });
178
+ }
179
+ async isPreviousPageEnabled() {
180
+ await this.enforcePartExistence("paginationAction");
181
+ return this.parts.paginationAction.isPreviousPageEnabled();
182
+ }
183
+ async gotoPreviousPage() {
184
+ await this.enforcePartExistence("paginationAction");
185
+ await this.parts.paginationAction.gotoPreviousPage();
186
+ }
187
+ async isNextPageEnabled() {
188
+ await this.enforcePartExistence("paginationAction");
189
+ return this.parts.paginationAction.isNextPageEnabled();
190
+ }
191
+ async gotoNextPage() {
192
+ await this.enforcePartExistence("paginationAction");
193
+ await this.parts.paginationAction.gotoNextPage();
194
+ }
195
+ async getPaginationDescription() {
196
+ await this.enforcePartExistence("paginationDescription");
197
+ return this.parts.paginationDescription.getText();
198
+ }
199
+ get driverName() {
200
+ return "MuiV8DataGridFooterDriver";
201
+ }
202
+ };
203
+
204
+ //#endregion
205
+ //#region src/components/datagrid/DataGridProDriver.ts
206
+ const parts = {
207
+ headerRow: {
208
+ locator: (0, __atomic_testing_core.byCssClass)("MuiDataGrid-columnHeaders").chain((0, __atomic_testing_core.byCssSelector)("[role=row]:first-of-type")),
209
+ driver: DataGridHeaderRowDriver
210
+ },
211
+ loading: {
212
+ locator: (0, __atomic_testing_core.byRole)("progressbar"),
213
+ driver: __atomic_testing_component_driver_html.HTMLElementDriver
214
+ },
215
+ skeletonOverlay: {
216
+ locator: (0, __atomic_testing_core.byCssClass)("MuiDataGrid-main--hasSkeletonLoadingOverlay"),
217
+ driver: __atomic_testing_component_driver_html.HTMLElementDriver
218
+ },
219
+ footer: {
220
+ locator: (0, __atomic_testing_core.byCssClass)("MuiDataGrid-footerContainer"),
221
+ driver: DataGridFooterDriver
222
+ }
223
+ };
224
+ const dataRowLocator = (0, __atomic_testing_core.byCssSelector)("[role=row][data-rowindex]");
225
+ /**
226
+ * Driver for Material UI v8 DataGridPro component.
227
+ * V8 DataGridPro component does not support data-testid, to use data-testid
228
+ * to locate the component, you need to put the data-testid on the parent element of the grid
229
+ * @see https://mui.com/x/react-data-grid/
230
+ */
231
+ var DataGridProDriver = class extends __atomic_testing_core.ComponentDriver {
232
+ constructor(locator, interactor, option) {
233
+ super(locator, interactor, {
234
+ ...option,
235
+ parts
236
+ });
237
+ }
238
+ /**
239
+ * Checks if the data grid is currently loading.
240
+ * @returns A promise that resolves to a boolean indicating if the data grid is loading.
241
+ */
242
+ async isLoading() {
243
+ const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);
244
+ return result.some((v) => v);
245
+ }
246
+ /**
247
+ * Waits for the data grid to exit the loading state.
248
+ * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.
249
+ */
250
+ async waitForLoad(timeoutMs = 1e4) {
251
+ await this.parts.headerRow.waitUntilComponentState();
252
+ await this.waitUntil({
253
+ probeFn: () => this.isLoading(),
254
+ terminateCondition: false,
255
+ timeoutMs
256
+ });
257
+ }
258
+ /**
259
+ * The number of columns currently displayed in the data grid, note that data grid pro
260
+ * uses virtualize rendering, therefore the column count heavily depends on the viewport size
261
+ * @returns The number of columns currently displayed in the data grid
262
+ */
263
+ async getColumnCount() {
264
+ return this.parts.headerRow.getColumnCount();
265
+ }
266
+ /**
267
+ * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering
268
+ * @returns The array of text of the header row
269
+ */
270
+ async getHeaderText() {
271
+ return this.parts.headerRow.getRowText();
272
+ }
273
+ /**
274
+ * The number of rows currently displayed in the data grid, note that data grid pro
275
+ * uses virtualize rendering, therefore the row count heavily depends on the viewport size
276
+ * @returns The number of columns currently displayed in the data grid
277
+ */
278
+ async getRowCount() {
279
+ const gridRowLocator = __atomic_testing_core.locatorUtil.append(this.locator, dataRowLocator);
280
+ let count = 0;
281
+ for await (const _ of __atomic_testing_core.listHelper.getListItemIterator(this, gridRowLocator, __atomic_testing_component_driver_html.HTMLElementDriver)) count++;
282
+ return count;
283
+ }
284
+ /**
285
+ * Return the row driver for the row at the specified index, if the row does not exist, return null
286
+ * @param rowIndex
287
+ * @returns
288
+ */
289
+ async getRow(rowIndex) {
290
+ const rowLocator = __atomic_testing_core.locatorUtil.append(this.locator, (0, __atomic_testing_core.byCssSelector)(`[role=row][data-rowindex="${rowIndex}"]`));
291
+ const rowExists = await this.interactor.exists(rowLocator);
292
+ if (rowExists) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
293
+ return null;
294
+ }
295
+ /**
296
+ * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering
297
+ * @param rowIndex The index of the row
298
+ * @returns The array of text of the specified row
299
+ */
300
+ async getRowText(rowIndex) {
301
+ const row = await this.getRow(rowIndex);
302
+ if (row != null) return row.getRowText();
303
+ throw new Error(`Row ${rowIndex} does not exist`);
304
+ }
305
+ /**
306
+ * Get the cell driver for the cell, if the cell does not exist, return null
307
+ * The cell driver is default to HTMLElementDriver, you can specify a different driver class
308
+ * @param query The query to locate the cell
309
+ * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver
310
+ * @returns
311
+ */
312
+ async getCell(query, driverClass = __atomic_testing_component_driver_html.HTMLElementDriver) {
313
+ const rowDriver = await this.getRow(query.rowIndex);
314
+ if (rowDriver === null) return null;
315
+ if ("columnIndex" in query) return rowDriver.getCell(query.columnIndex, driverClass);
316
+ return rowDriver.getCell(query.columnField, driverClass);
317
+ }
318
+ /**
319
+ * Get the text content of the cell, if the cell does not exist, throw an error
320
+ * @param query The query to locate the cell
321
+ * @returns
322
+ */
323
+ async getCellText(query) {
324
+ const cell = await this.getCell(query);
325
+ if (cell != null) {
326
+ const text = await cell.getText();
327
+ return text;
328
+ }
329
+ throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);
330
+ }
331
+ isFooterVisible() {
332
+ return this.parts.footer.isVisible();
333
+ }
334
+ async isPreviousPageEnabled() {
335
+ await this.enforcePartExistence("footer");
336
+ return this.parts.footer.isPreviousPageEnabled();
337
+ }
338
+ async gotoPreviousPage() {
339
+ await this.enforcePartExistence("footer");
340
+ await this.parts.footer.gotoPreviousPage();
341
+ }
342
+ async isNextPageEnabled() {
343
+ await this.enforcePartExistence("footer");
344
+ return this.parts.footer.isNextPageEnabled();
345
+ }
346
+ async gotoNextPage() {
347
+ await this.enforcePartExistence("footer");
348
+ await this.parts.footer.gotoNextPage();
349
+ }
350
+ async getPaginationDescription() {
351
+ await this.enforcePartExistence("footer");
352
+ return this.parts.footer.getText();
353
+ }
354
+ get driverName() {
355
+ return "MuiV8DataGridProDriver";
356
+ }
357
+ };
358
+
359
+ //#endregion
360
+ exports.DataGridDataRowDriver = DataGridDataRowDriver;
361
+ exports.DataGridHeaderRowDriver = DataGridHeaderRowDriver;
362
+ exports.DataGridProDriver = DataGridProDriver;
18
363
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
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 isFooterVisible(): Promise<boolean> {\n return this.parts.footer.isVisible();\n }\n\n async isPreviousPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isPreviousPageEnabled();\n }\n\n async gotoPreviousPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoPreviousPage();\n }\n\n async isNextPageEnabled(): Promise<boolean> {\n await this.enforcePartExistence('footer');\n return this.parts.footer.isNextPageEnabled();\n }\n\n async gotoNextPage(): Promise<void> {\n await this.enforcePartExistence('footer');\n await this.parts.footer.gotoNextPage();\n }\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,sCAAgB;CAClE,MAAgB,eAAgC;EAC9C,IAAI,QAAQ;AACZ,aAAW,MAAM,KAAK,iCAAW,oBAC/B,MACA,KAAK,gBAAgB,EACrBC,0DACA,oBACD,CACC;AAEF,SAAO;CACR;;;;;;CAOD,MAAM,aAAgC;EACpC,MAAMC,WAAqB,CAAE;AAC7B,aAAW,MAAM,QAAQ,iCAAW,oBAClC,MACA,KAAK,gBAAgB,EACrBD,0DACA,oBACD,EAAE;GACD,MAAM,OAAO,MAAM,KAAK,SAAS;AACjC,YAAS,KAAK,KAAM,MAAM,CAAC;EAC5B;AACD,SAAO;CACR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