@atomic-testing/component-driver-mui-x-v8 0.58.0 → 0.60.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.mjs ADDED
@@ -0,0 +1,338 @@
1
+ import { ComponentDriver, byAttribute, byCssClass, byCssSelector, byRole, listHelper, locatorUtil } from "@atomic-testing/core";
2
+ import { HTMLButtonDriver, HTMLElementDriver } from "@atomic-testing/component-driver-html";
3
+
4
+ //#region src/components/datagrid/DataGridRowDriverBase.ts
5
+ const columnStartingIndex = 1;
6
+ /**
7
+ * Base class for data grid row
8
+ */
9
+ var DataGridRowDriverBase = class extends ComponentDriver {
10
+ async getCellCount() {
11
+ let count = 0;
12
+ for await (const _ of listHelper.getListItemIterator(this, this.getCellLocator(), HTMLElementDriver, columnStartingIndex)) count++;
13
+ return count;
14
+ }
15
+ /**
16
+ * Get the text of each visible cell in the row.
17
+ * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.
18
+ * @returns A promise array of text of each visible cell in the row
19
+ */
20
+ async getRowText() {
21
+ const textList = [];
22
+ for await (const cell of listHelper.getListItemIterator(this, this.getCellLocator(), HTMLElementDriver, columnStartingIndex)) {
23
+ const text = await cell.getText();
24
+ textList.push(text.trim());
25
+ }
26
+ return textList;
27
+ }
28
+ /**
29
+ * Get the cell driver at the specified index or data field.
30
+ * Caveat: Because of virtualization, the cell may not be available until the cell is visible.
31
+ * @param cellIndexOrField number: column index, string: column field
32
+ * @param driverClass The driver class of the cell. Default is HTMLElementDriver
33
+ * @returns A promise of the cell driver, or null if the cell is not found
34
+ */
35
+ async getCell(cellIndexOrField, driverClass = HTMLElementDriver) {
36
+ let cellLocator;
37
+ if (typeof cellIndexOrField === "number") cellLocator = byAttribute("data-colindex", cellIndexOrField.toString());
38
+ else cellLocator = byAttribute("data-field", cellIndexOrField);
39
+ const locator = locatorUtil.append(this.locator, cellLocator);
40
+ const cellExists = await this.interactor.exists(locator);
41
+ if (cellExists) return new driverClass(locator, this.interactor, this.commutableOption);
42
+ return null;
43
+ }
44
+ };
45
+
46
+ //#endregion
47
+ //#region src/components/datagrid/DataGridDataRowDriver.ts
48
+ var DataGridDataRowDriver = class extends DataGridRowDriverBase {
49
+ _dataCellLocator;
50
+ constructor(locator, interactor, option) {
51
+ super(locator, interactor, {
52
+ ...option,
53
+ parts: {}
54
+ });
55
+ this._dataCellLocator = locatorUtil.append(locator, byRole("cell"));
56
+ }
57
+ getCellLocator() {
58
+ return this._dataCellLocator;
59
+ }
60
+ get driverName() {
61
+ return "MuiV8DataGridDataRowDriver";
62
+ }
63
+ };
64
+
65
+ //#endregion
66
+ //#region src/components/datagrid/DataGridHeaderRowDriver.ts
67
+ var DataGridHeaderRowDriver = class extends DataGridRowDriverBase {
68
+ _headerCellLocator;
69
+ constructor(locator, interactor, option) {
70
+ super(locator, interactor, {
71
+ ...option,
72
+ parts: {}
73
+ });
74
+ this._headerCellLocator = locatorUtil.append(locator, byRole("columnheader"));
75
+ }
76
+ async getColumnCount() {
77
+ return this.getCellCount();
78
+ }
79
+ getCellLocator() {
80
+ return this._headerCellLocator;
81
+ }
82
+ get driverName() {
83
+ return "MuiV8DataGridHeaderRowDriver";
84
+ }
85
+ };
86
+
87
+ //#endregion
88
+ //#region src/components/datagrid/DataGridPaginationActionDriver.ts
89
+ const parts$2 = {
90
+ previousButton: {
91
+ locator: byAttribute("aria-label", "Go to previous page"),
92
+ driver: HTMLButtonDriver
93
+ },
94
+ nextButton: {
95
+ locator: byAttribute("aria-label", "Go to next page"),
96
+ driver: HTMLButtonDriver
97
+ }
98
+ };
99
+ /**
100
+ * Driver for Material UI v6 DataGridPro component.
101
+ * @see https://mui.com/x/react-data-grid/
102
+ */
103
+ var DataGridPaginationActionDriver = class extends ComponentDriver {
104
+ constructor(locator, interactor, option) {
105
+ super(locator, interactor, {
106
+ ...option,
107
+ parts: parts$2
108
+ });
109
+ }
110
+ async isPreviousPageEnabled() {
111
+ await this.enforcePartExistence("previousButton");
112
+ const isDisabled = await this.parts.previousButton.isDisabled();
113
+ return !isDisabled;
114
+ }
115
+ async gotoPreviousPage() {
116
+ await this.enforcePartExistence("previousButton");
117
+ await this.parts.previousButton.click();
118
+ }
119
+ async isNextPageEnabled() {
120
+ await this.enforcePartExistence("nextButton");
121
+ const isDisabled = await this.parts.nextButton.isDisabled();
122
+ return !isDisabled;
123
+ }
124
+ async gotoNextPage() {
125
+ await this.enforcePartExistence("nextButton");
126
+ await this.parts.nextButton.click();
127
+ }
128
+ get driverName() {
129
+ return "MuiV8DataGridPaginationActionDriver";
130
+ }
131
+ };
132
+
133
+ //#endregion
134
+ //#region src/components/datagrid/DataGridFooterDriver.ts
135
+ const parts$1 = {
136
+ paginationAction: {
137
+ locator: byCssClass("MuiTablePagination-actions"),
138
+ driver: DataGridPaginationActionDriver
139
+ },
140
+ paginationDescription: {
141
+ locator: byCssClass("MuiTablePagination-displayedRows"),
142
+ driver: HTMLElementDriver
143
+ }
144
+ };
145
+ /**
146
+ * Driver for Material UI v6 DataGridPro component.
147
+ * @see https://mui.com/x/react-data-grid/
148
+ */
149
+ var DataGridFooterDriver = class extends ComponentDriver {
150
+ constructor(locator, interactor, option) {
151
+ super(locator, interactor, {
152
+ ...option,
153
+ parts: parts$1
154
+ });
155
+ }
156
+ async isPreviousPageEnabled() {
157
+ await this.enforcePartExistence("paginationAction");
158
+ return this.parts.paginationAction.isPreviousPageEnabled();
159
+ }
160
+ async gotoPreviousPage() {
161
+ await this.enforcePartExistence("paginationAction");
162
+ await this.parts.paginationAction.gotoPreviousPage();
163
+ }
164
+ async isNextPageEnabled() {
165
+ await this.enforcePartExistence("paginationAction");
166
+ return this.parts.paginationAction.isNextPageEnabled();
167
+ }
168
+ async gotoNextPage() {
169
+ await this.enforcePartExistence("paginationAction");
170
+ await this.parts.paginationAction.gotoNextPage();
171
+ }
172
+ async getPaginationDescription() {
173
+ await this.enforcePartExistence("paginationDescription");
174
+ return this.parts.paginationDescription.getText();
175
+ }
176
+ get driverName() {
177
+ return "MuiV8DataGridFooterDriver";
178
+ }
179
+ };
180
+
181
+ //#endregion
182
+ //#region src/components/datagrid/DataGridProDriver.ts
183
+ const parts = {
184
+ headerRow: {
185
+ locator: byCssClass("MuiDataGrid-columnHeaders").chain(byCssSelector("[role=row]:first-of-type")),
186
+ driver: DataGridHeaderRowDriver
187
+ },
188
+ loading: {
189
+ locator: byRole("progressbar"),
190
+ driver: HTMLElementDriver
191
+ },
192
+ skeletonOverlay: {
193
+ locator: byCssClass("MuiDataGrid-main--hasSkeletonLoadingOverlay"),
194
+ driver: HTMLElementDriver
195
+ },
196
+ footer: {
197
+ locator: byCssClass("MuiDataGrid-footerContainer"),
198
+ driver: DataGridFooterDriver
199
+ }
200
+ };
201
+ const dataRowLocator = byCssSelector("[role=row][data-rowindex]");
202
+ /**
203
+ * Driver for Material UI v8 DataGridPro component.
204
+ * V8 DataGridPro component does not support data-testid, to use data-testid
205
+ * to locate the component, you need to put the data-testid on the parent element of the grid
206
+ * @see https://mui.com/x/react-data-grid/
207
+ */
208
+ var DataGridProDriver = class extends ComponentDriver {
209
+ constructor(locator, interactor, option) {
210
+ super(locator, interactor, {
211
+ ...option,
212
+ parts
213
+ });
214
+ }
215
+ /**
216
+ * Checks if the data grid is currently loading.
217
+ * @returns A promise that resolves to a boolean indicating if the data grid is loading.
218
+ */
219
+ async isLoading() {
220
+ const result = await Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);
221
+ return result.some((v) => v);
222
+ }
223
+ /**
224
+ * Waits for the data grid to exit the loading state.
225
+ * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.
226
+ */
227
+ async waitForLoad(timeoutMs = 1e4) {
228
+ await this.parts.headerRow.waitUntilComponentState();
229
+ await this.waitUntil({
230
+ probeFn: () => this.isLoading(),
231
+ terminateCondition: false,
232
+ timeoutMs
233
+ });
234
+ }
235
+ /**
236
+ * The number of columns currently displayed in the data grid, note that data grid pro
237
+ * uses virtualize rendering, therefore the column count heavily depends on the viewport size
238
+ * @returns The number of columns currently displayed in the data grid
239
+ */
240
+ async getColumnCount() {
241
+ return this.parts.headerRow.getColumnCount();
242
+ }
243
+ /**
244
+ * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering
245
+ * @returns The array of text of the header row
246
+ */
247
+ async getHeaderText() {
248
+ return this.parts.headerRow.getRowText();
249
+ }
250
+ /**
251
+ * The number of rows currently displayed in the data grid, note that data grid pro
252
+ * uses virtualize rendering, therefore the row count heavily depends on the viewport size
253
+ * @returns The number of columns currently displayed in the data grid
254
+ */
255
+ async getRowCount() {
256
+ const gridRowLocator = locatorUtil.append(this.locator, dataRowLocator);
257
+ let count = 0;
258
+ for await (const _ of listHelper.getListItemIterator(this, gridRowLocator, HTMLElementDriver)) count++;
259
+ return count;
260
+ }
261
+ /**
262
+ * Return the row driver for the row at the specified index, if the row does not exist, return null
263
+ * @param rowIndex
264
+ * @returns
265
+ */
266
+ async getRow(rowIndex) {
267
+ const rowLocator = locatorUtil.append(this.locator, byCssSelector(`[role=row][data-rowindex="${rowIndex}"]`));
268
+ const rowExists = await this.interactor.exists(rowLocator);
269
+ if (rowExists) return new DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
270
+ return null;
271
+ }
272
+ /**
273
+ * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering
274
+ * @param rowIndex The index of the row
275
+ * @returns The array of text of the specified row
276
+ */
277
+ async getRowText(rowIndex) {
278
+ const row = await this.getRow(rowIndex);
279
+ if (row != null) return row.getRowText();
280
+ throw new Error(`Row ${rowIndex} does not exist`);
281
+ }
282
+ /**
283
+ * Get the cell driver for the cell, if the cell does not exist, return null
284
+ * The cell driver is default to HTMLElementDriver, you can specify a different driver class
285
+ * @param query The query to locate the cell
286
+ * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver
287
+ * @returns
288
+ */
289
+ async getCell(query, driverClass = HTMLElementDriver) {
290
+ const rowDriver = await this.getRow(query.rowIndex);
291
+ if (rowDriver === null) return null;
292
+ if ("columnIndex" in query) return rowDriver.getCell(query.columnIndex, driverClass);
293
+ return rowDriver.getCell(query.columnField, driverClass);
294
+ }
295
+ /**
296
+ * Get the text content of the cell, if the cell does not exist, throw an error
297
+ * @param query The query to locate the cell
298
+ * @returns
299
+ */
300
+ async getCellText(query) {
301
+ const cell = await this.getCell(query);
302
+ if (cell != null) {
303
+ const text = await cell.getText();
304
+ return text;
305
+ }
306
+ throw new Error(`Cell at row:${query.rowIndex} column:${query.columnIndex ?? query.columnField} does not exist`);
307
+ }
308
+ isFooterVisible() {
309
+ return this.parts.footer.isVisible();
310
+ }
311
+ async isPreviousPageEnabled() {
312
+ await this.enforcePartExistence("footer");
313
+ return this.parts.footer.isPreviousPageEnabled();
314
+ }
315
+ async gotoPreviousPage() {
316
+ await this.enforcePartExistence("footer");
317
+ await this.parts.footer.gotoPreviousPage();
318
+ }
319
+ async isNextPageEnabled() {
320
+ await this.enforcePartExistence("footer");
321
+ return this.parts.footer.isNextPageEnabled();
322
+ }
323
+ async gotoNextPage() {
324
+ await this.enforcePartExistence("footer");
325
+ await this.parts.footer.gotoNextPage();
326
+ }
327
+ async getPaginationDescription() {
328
+ await this.enforcePartExistence("footer");
329
+ return this.parts.footer.getText();
330
+ }
331
+ get driverName() {
332
+ return "MuiV8DataGridProDriver";
333
+ }
334
+ };
335
+
336
+ //#endregion
337
+ export { DataGridDataRowDriver, DataGridHeaderRowDriver, DataGridProDriver };
338
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +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 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 //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AI,QAAQ,MAAM;GAChB,MAAM,OAAO,MAAM,KAAK,SAAS;AACjC,UAAO;EACR;AAGD,QAAM,IAAI,OAAO,cAAc,MAAM,SAAS,UAAU,MAAM,eAAe,MAAM,YAAY;CAChG;CAGD,kBAAoC;AAClC,SAAO,KAAK,MAAM,OAAO,WAAW;CACrC;CAED,MAAM,wBAA0C;AAC9C,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,uBAAuB;CACjD;CAED,MAAM,mBAAkC;AACtC,QAAM,KAAK,qBAAqB,SAAS;AACzC,QAAM,KAAK,MAAM,OAAO,kBAAkB;CAC3C;CAED,MAAM,oBAAsC;AAC1C,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,mBAAmB;CAC7C;CAED,MAAM,eAA8B;AAClC,QAAM,KAAK,qBAAqB,SAAS;AACzC,QAAM,KAAK,MAAM,OAAO,cAAc;CACvC;CAED,MAAM,2BAAsD;AAC1D,QAAM,KAAK,qBAAqB,SAAS;AACzC,SAAO,KAAK,MAAM,OAAO,SAAS;CACnC;CAGD,IAAa,aAAqB;AAChC,SAAO;CACR;AACF"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@atomic-testing/component-driver-mui-x-v8",
3
- "version": "0.58.0",
3
+ "version": "0.60.0",
4
4
  "description": "Atomic Testing Component driver to help drive Material UI X V8 components",
5
5
  "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
6
7
  "types": "dist/index.d.ts",
7
8
  "files": [
8
9
  "dist",
@@ -27,9 +28,9 @@
27
28
  },
28
29
  "dependencies": {
29
30
  "dayjs": "^1.11.13",
30
- "@atomic-testing/core": "0.58.0",
31
- "@atomic-testing/component-driver-mui-v6": "0.58.0",
32
- "@atomic-testing/component-driver-html": "0.58.0"
31
+ "@atomic-testing/component-driver-mui-v6": "0.60.0",
32
+ "@atomic-testing/core": "0.60.0",
33
+ "@atomic-testing/component-driver-html": "0.60.0"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@testing-library/dom": "^10.4.0",
@@ -41,8 +42,7 @@
41
42
  "typescript": "^5.8.3"
42
43
  },
43
44
  "scripts": {
44
- "build": "tsc",
45
- "postbuild": "node ../../scripts/postBuild.mjs",
46
- "test": "jest --maxConcurrency=1"
45
+ "build": "tsdown",
46
+ "check:type": "tsc --noEmit"
47
47
  }
48
48
  }
@@ -1,9 +0,0 @@
1
- export interface CellQueryByColumnIndex {
2
- rowIndex: number;
3
- columnIndex: number;
4
- }
5
- export interface CellQueryByColumnField {
6
- rowIndex: number;
7
- columnField: string;
8
- }
9
- export type DataGridCellQuery = CellQueryByColumnIndex | CellQueryByColumnField;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=DataGridCellQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataGridCellQuery.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridCellQuery.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { IComponentDriverOption, Interactor, PartLocator } from '@atomic-testing/core';
2
- import { DataGridRowDriverBase } from './DataGridRowDriverBase';
3
- export declare class DataGridDataRowDriver extends DataGridRowDriverBase {
4
- private readonly _dataCellLocator;
5
- constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
6
- protected getCellLocator(): PartLocator;
7
- get driverName(): string;
8
- }
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataGridDataRowDriver = void 0;
4
- const core_1 = require("@atomic-testing/core");
5
- const DataGridRowDriverBase_1 = require("./DataGridRowDriverBase");
6
- class DataGridDataRowDriver extends DataGridRowDriverBase_1.DataGridRowDriverBase {
7
- constructor(locator, interactor, option) {
8
- super(locator, interactor, Object.assign(Object.assign({}, option), { parts: {} }));
9
- this._dataCellLocator = core_1.locatorUtil.append(locator, (0, core_1.byRole)('cell'));
10
- }
11
- getCellLocator() {
12
- return this._dataCellLocator;
13
- }
14
- get driverName() {
15
- return 'MuiV8DataGridDataRowDriver';
16
- }
17
- }
18
- exports.DataGridDataRowDriver = DataGridDataRowDriver;
19
- //# sourceMappingURL=DataGridDataRowDriver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataGridDataRowDriver.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridDataRowDriver.ts"],"names":[],"mappings":";;;AAAA,+CAA4G;AAE5G,mEAAgE;AAEhE,MAAa,qBAAsB,SAAQ,6CAAqB;IAE9D,YAAY,OAAoB,EAAE,UAAsB,EAAE,MAAwC;QAChG,KAAK,CAAC,OAAO,EAAE,UAAU,kCACpB,MAAM,KACT,KAAK,EAAE,EAAE,IACT,CAAC;QAEH,IAAI,CAAC,gBAAgB,GAAG,kBAAW,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC;IAEkB,cAAc;QAC/B,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,IAAa,UAAU;QACrB,OAAO,4BAA4B,CAAC;IACtC,CAAC;CACF;AAlBD,sDAkBC"}
@@ -1,27 +0,0 @@
1
- import { HTMLElementDriver } from '@atomic-testing/component-driver-html';
2
- import { ComponentDriver, IComponentDriverOption, Interactor, Optional, PartLocator } from '@atomic-testing/core';
3
- import { DataGridPaginationActionDriver } from './DataGridPaginationActionDriver';
4
- declare const parts: {
5
- paginationAction: {
6
- locator: import("@atomic-testing/core").CssLocator;
7
- driver: typeof DataGridPaginationActionDriver;
8
- };
9
- paginationDescription: {
10
- locator: import("@atomic-testing/core").CssLocator;
11
- driver: typeof HTMLElementDriver;
12
- };
13
- };
14
- /**
15
- * Driver for Material UI v6 DataGridPro component.
16
- * @see https://mui.com/x/react-data-grid/
17
- */
18
- export declare class DataGridFooterDriver extends ComponentDriver<typeof parts> {
19
- constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
20
- isPreviousPageEnabled(): Promise<boolean>;
21
- gotoPreviousPage(): Promise<void>;
22
- isNextPageEnabled(): Promise<boolean>;
23
- gotoNextPage(): Promise<void>;
24
- getPaginationDescription(): Promise<Optional<string>>;
25
- get driverName(): string;
26
- }
27
- export {};
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DataGridFooterDriver = void 0;
13
- const component_driver_html_1 = require("@atomic-testing/component-driver-html");
14
- const core_1 = require("@atomic-testing/core");
15
- const DataGridPaginationActionDriver_1 = require("./DataGridPaginationActionDriver");
16
- const parts = {
17
- paginationAction: {
18
- locator: (0, core_1.byCssClass)('MuiTablePagination-actions'),
19
- driver: DataGridPaginationActionDriver_1.DataGridPaginationActionDriver,
20
- },
21
- paginationDescription: {
22
- locator: (0, core_1.byCssClass)('MuiTablePagination-displayedRows'),
23
- driver: component_driver_html_1.HTMLElementDriver,
24
- },
25
- };
26
- /**
27
- * Driver for Material UI v6 DataGridPro component.
28
- * @see https://mui.com/x/react-data-grid/
29
- */
30
- class DataGridFooterDriver extends core_1.ComponentDriver {
31
- constructor(locator, interactor, option) {
32
- super(locator, interactor, Object.assign(Object.assign({}, option), { parts }));
33
- }
34
- isPreviousPageEnabled() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- yield this.enforcePartExistence('paginationAction');
37
- return this.parts.paginationAction.isPreviousPageEnabled();
38
- });
39
- }
40
- gotoPreviousPage() {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- yield this.enforcePartExistence('paginationAction');
43
- yield this.parts.paginationAction.gotoPreviousPage();
44
- });
45
- }
46
- isNextPageEnabled() {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- yield this.enforcePartExistence('paginationAction');
49
- return this.parts.paginationAction.isNextPageEnabled();
50
- });
51
- }
52
- gotoNextPage() {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- yield this.enforcePartExistence('paginationAction');
55
- yield this.parts.paginationAction.gotoNextPage();
56
- });
57
- }
58
- getPaginationDescription() {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- yield this.enforcePartExistence('paginationDescription');
61
- return this.parts.paginationDescription.getText();
62
- });
63
- }
64
- get driverName() {
65
- return 'MuiV8DataGridFooterDriver';
66
- }
67
- }
68
- exports.DataGridFooterDriver = DataGridFooterDriver;
69
- //# sourceMappingURL=DataGridFooterDriver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataGridFooterDriver.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridFooterDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAA0E;AAC1E,+CAQ8B;AAE9B,qFAAkF;AAElF,MAAM,KAAK,GAAG;IACZ,gBAAgB,EAAE;QAChB,OAAO,EAAE,IAAA,iBAAU,EAAC,4BAA4B,CAAC;QACjD,MAAM,EAAE,+DAA8B;KACvC;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,IAAA,iBAAU,EAAC,kCAAkC,CAAC;QACvD,MAAM,EAAE,yCAAiB;KAC1B;CACkB,CAAC;AAEtB;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,sBAA6B;IACrE,YAAY,OAAoB,EAAE,UAAsB,EAAE,MAAwC;QAChG,KAAK,CAAC,OAAO,EAAE,UAAU,kCACpB,MAAM,KACT,KAAK,IACL,CAAC;IACL,CAAC;IAEK,qBAAqB;;YACzB,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC;QAC7D,CAAC;KAAA;IAEK,gBAAgB;;YACpB,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;QACvD,CAAC;KAAA;IAEK,iBAAiB;;YACrB,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QACzD,CAAC;KAAA;IAEK,YAAY;;YAChB,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;YACpD,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACnD,CAAC;KAAA;IAEK,wBAAwB;;YAC5B,MAAM,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;QACpD,CAAC;KAAA;IAED,IAAa,UAAU;QACrB,OAAO,2BAA2B,CAAC;IACrC,CAAC;CACF;AApCD,oDAoCC"}
@@ -1,9 +0,0 @@
1
- import { IComponentDriverOption, Interactor, PartLocator } from '@atomic-testing/core';
2
- import { DataGridRowDriverBase } from './DataGridRowDriverBase';
3
- export declare class DataGridHeaderRowDriver extends DataGridRowDriverBase {
4
- private readonly _headerCellLocator;
5
- constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
6
- getColumnCount(): Promise<number>;
7
- protected getCellLocator(): PartLocator;
8
- get driverName(): string;
9
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DataGridHeaderRowDriver = void 0;
13
- const core_1 = require("@atomic-testing/core");
14
- const DataGridRowDriverBase_1 = require("./DataGridRowDriverBase");
15
- class DataGridHeaderRowDriver extends DataGridRowDriverBase_1.DataGridRowDriverBase {
16
- constructor(locator, interactor, option) {
17
- super(locator, interactor, Object.assign(Object.assign({}, option), { parts: {} }));
18
- this._headerCellLocator = core_1.locatorUtil.append(locator, (0, core_1.byRole)('columnheader'));
19
- }
20
- getColumnCount() {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- return this.getCellCount();
23
- });
24
- }
25
- getCellLocator() {
26
- return this._headerCellLocator;
27
- }
28
- get driverName() {
29
- return 'MuiV8DataGridHeaderRowDriver';
30
- }
31
- }
32
- exports.DataGridHeaderRowDriver = DataGridHeaderRowDriver;
33
- //# sourceMappingURL=DataGridHeaderRowDriver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataGridHeaderRowDriver.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridHeaderRowDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4G;AAE5G,mEAAgE;AAEhE,MAAa,uBAAwB,SAAQ,6CAAqB;IAEhE,YAAY,OAAoB,EAAE,UAAsB,EAAE,MAAwC;QAChG,KAAK,CAAC,OAAO,EAAE,UAAU,kCACpB,MAAM,KACT,KAAK,EAAE,EAAE,IACT,CAAC;QAEH,IAAI,CAAC,kBAAkB,GAAG,kBAAW,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,aAAM,EAAC,cAAc,CAAC,CAAC,CAAC;IAChF,CAAC;IAEK,cAAc;;YAClB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;KAAA;IAEkB,cAAc;QAC/B,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,IAAa,UAAU;QACrB,OAAO,8BAA8B,CAAC;IACxC,CAAC;CACF;AAtBD,0DAsBC"}
@@ -1,25 +0,0 @@
1
- import { HTMLButtonDriver } from '@atomic-testing/component-driver-html';
2
- import { ComponentDriver, IComponentDriverOption, Interactor, PartLocator } from '@atomic-testing/core';
3
- declare const parts: {
4
- previousButton: {
5
- locator: import("@atomic-testing/core").CssLocator;
6
- driver: typeof HTMLButtonDriver;
7
- };
8
- nextButton: {
9
- locator: import("@atomic-testing/core").CssLocator;
10
- driver: typeof HTMLButtonDriver;
11
- };
12
- };
13
- /**
14
- * Driver for Material UI v6 DataGridPro component.
15
- * @see https://mui.com/x/react-data-grid/
16
- */
17
- export declare class DataGridPaginationActionDriver extends ComponentDriver<typeof parts> {
18
- constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
19
- isPreviousPageEnabled(): Promise<boolean>;
20
- gotoPreviousPage(): Promise<void>;
21
- isNextPageEnabled(): Promise<boolean>;
22
- gotoNextPage(): Promise<void>;
23
- get driverName(): string;
24
- }
25
- export {};