@atomic-testing/component-driver-mui-x-v8 0.58.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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -0
  3. package/dist/components/datagrid/DataGridCellQuery.d.ts +9 -0
  4. package/dist/components/datagrid/DataGridCellQuery.js +3 -0
  5. package/dist/components/datagrid/DataGridCellQuery.js.map +1 -0
  6. package/dist/components/datagrid/DataGridDataRowDriver.d.ts +8 -0
  7. package/dist/components/datagrid/DataGridDataRowDriver.js +19 -0
  8. package/dist/components/datagrid/DataGridDataRowDriver.js.map +1 -0
  9. package/dist/components/datagrid/DataGridFooterDriver.d.ts +27 -0
  10. package/dist/components/datagrid/DataGridFooterDriver.js +69 -0
  11. package/dist/components/datagrid/DataGridFooterDriver.js.map +1 -0
  12. package/dist/components/datagrid/DataGridHeaderRowDriver.d.ts +9 -0
  13. package/dist/components/datagrid/DataGridHeaderRowDriver.js +33 -0
  14. package/dist/components/datagrid/DataGridHeaderRowDriver.js.map +1 -0
  15. package/dist/components/datagrid/DataGridPaginationActionDriver.d.ts +25 -0
  16. package/dist/components/datagrid/DataGridPaginationActionDriver.js +64 -0
  17. package/dist/components/datagrid/DataGridPaginationActionDriver.js.map +1 -0
  18. package/dist/components/datagrid/DataGridProDriver.d.ts +93 -0
  19. package/dist/components/datagrid/DataGridProDriver.js +227 -0
  20. package/dist/components/datagrid/DataGridProDriver.js.map +1 -0
  21. package/dist/components/datagrid/DataGridRowDriverBase.d.ts +23 -0
  22. package/dist/components/datagrid/DataGridRowDriverBase.js +107 -0
  23. package/dist/components/datagrid/DataGridRowDriverBase.js.map +1 -0
  24. package/dist/components/datagrid/index.d.ts +4 -0
  25. package/dist/components/datagrid/index.js +25 -0
  26. package/dist/components/datagrid/index.js.map +1 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +18 -0
  29. package/dist/index.js.map +1 -0
  30. package/package.json +48 -0
  31. package/src/components/datagrid/DataGridCellQuery.ts +11 -0
  32. package/src/components/datagrid/DataGridDataRowDriver.ts +23 -0
  33. package/src/components/datagrid/DataGridFooterDriver.ts +65 -0
  34. package/src/components/datagrid/DataGridHeaderRowDriver.ts +27 -0
  35. package/src/components/datagrid/DataGridPaginationActionDriver.ts +59 -0
  36. package/src/components/datagrid/DataGridProDriver.ts +207 -0
  37. package/src/components/datagrid/DataGridRowDriverBase.ts +72 -0
  38. package/src/components/datagrid/index.ts +4 -0
  39. package/src/index.ts +1 -0
@@ -0,0 +1,72 @@
1
+ import { HTMLElementDriver } from '@atomic-testing/component-driver-html';
2
+ import { byAttribute, ComponentDriver, listHelper, locatorUtil, PartLocator } from '@atomic-testing/core';
3
+
4
+ // In MUI7, there is an extra div preceding the actual data cells. We need to skip it.
5
+ const columnStartingIndex = 1;
6
+
7
+ /**
8
+ * Base class for data grid row
9
+ */
10
+ export abstract class DataGridRowDriverBase extends ComponentDriver {
11
+ protected async getCellCount(): Promise<number> {
12
+ let count = 0;
13
+ for await (const _ of listHelper.getListItemIterator(
14
+ this,
15
+ this.getCellLocator(),
16
+ HTMLElementDriver,
17
+ columnStartingIndex
18
+ )) {
19
+ count++;
20
+ }
21
+ return count;
22
+ }
23
+
24
+ /**
25
+ * Get the text of each visible cell in the row.
26
+ * Caveat: Because of virtualization, the text of the cell may not be available until the cell is visible.
27
+ * @returns A promise array of text of each visible cell in the row
28
+ */
29
+ async getRowText(): Promise<string[]> {
30
+ const textList: string[] = [];
31
+ for await (const cell of listHelper.getListItemIterator(
32
+ this,
33
+ this.getCellLocator(),
34
+ HTMLElementDriver,
35
+ columnStartingIndex
36
+ )) {
37
+ const text = await cell.getText();
38
+ textList.push(text!.trim());
39
+ }
40
+ return textList;
41
+ }
42
+
43
+ /**
44
+ * Get the cell driver at the specified index or data field.
45
+ * Caveat: Because of virtualization, the cell may not be available until the cell is visible.
46
+ * @param cellIndexOrField number: column index, string: column field
47
+ * @param driverClass The driver class of the cell. Default is HTMLElementDriver
48
+ * @returns A promise of the cell driver, or null if the cell is not found
49
+ */
50
+ async getCell<DriverT extends ComponentDriver>(
51
+ cellIndexOrField: number | string, // number: column index, string: column field
52
+ // @ts-ignore
53
+ driverClass: typeof ComponentDriver = HTMLElementDriver
54
+ ): Promise<DriverT | null> {
55
+ let cellLocator: PartLocator;
56
+ if (typeof cellIndexOrField === 'number') {
57
+ cellLocator = byAttribute('data-colindex', cellIndexOrField.toString());
58
+ } else {
59
+ cellLocator = byAttribute('data-field', cellIndexOrField);
60
+ }
61
+ const locator = locatorUtil.append(this.locator, cellLocator);
62
+ const cellExists = await this.interactor.exists(locator);
63
+ if (cellExists) {
64
+ // @ts-ignore
65
+ return new driverClass(locator, this.interactor, this.commutableOption);
66
+ }
67
+
68
+ return null;
69
+ }
70
+
71
+ protected abstract getCellLocator(): PartLocator;
72
+ }
@@ -0,0 +1,4 @@
1
+ export * from './DataGridCellQuery';
2
+ export { DataGridDataRowDriver } from './DataGridDataRowDriver';
3
+ export { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';
4
+ export { DataGridProDriver } from './DataGridProDriver';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components/datagrid';