@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tianzhen Lin (Tangent)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @atomic-testing/component-driver-mui-x-v7
2
+
3
+ Component drivers for [Material UI X](https://mui.com/x/) v7 components.
4
+ They provide Atomic Testing wrappers for the latest MUI X widgets.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pnpm add @atomic-testing/component-driver-mui-x-v7
10
+ ```
11
+
12
+ See the [docs](https://atomic-testing.dev/) for usage instructions.
@@ -0,0 +1,9 @@
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;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DataGridCellQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataGridCellQuery.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridCellQuery.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,27 @@
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 {};
@@ -0,0 +1,69 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,33 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,25 @@
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 {};
@@ -0,0 +1,64 @@
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.DataGridPaginationActionDriver = void 0;
13
+ const component_driver_html_1 = require("@atomic-testing/component-driver-html");
14
+ const core_1 = require("@atomic-testing/core");
15
+ const parts = {
16
+ previousButton: {
17
+ locator: (0, core_1.byAttribute)('aria-label', 'Go to previous page'),
18
+ driver: component_driver_html_1.HTMLButtonDriver,
19
+ },
20
+ nextButton: {
21
+ locator: (0, core_1.byAttribute)('aria-label', 'Go to next page'),
22
+ driver: component_driver_html_1.HTMLButtonDriver,
23
+ },
24
+ };
25
+ /**
26
+ * Driver for Material UI v6 DataGridPro component.
27
+ * @see https://mui.com/x/react-data-grid/
28
+ */
29
+ class DataGridPaginationActionDriver extends core_1.ComponentDriver {
30
+ constructor(locator, interactor, option) {
31
+ super(locator, interactor, Object.assign(Object.assign({}, option), { parts }));
32
+ }
33
+ isPreviousPageEnabled() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ yield this.enforcePartExistence('previousButton');
36
+ const isDisabled = yield this.parts.previousButton.isDisabled();
37
+ return !isDisabled;
38
+ });
39
+ }
40
+ gotoPreviousPage() {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ yield this.enforcePartExistence('previousButton');
43
+ yield this.parts.previousButton.click();
44
+ });
45
+ }
46
+ isNextPageEnabled() {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ yield this.enforcePartExistence('nextButton');
49
+ const isDisabled = yield this.parts.nextButton.isDisabled();
50
+ return !isDisabled;
51
+ });
52
+ }
53
+ gotoNextPage() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ yield this.enforcePartExistence('nextButton');
56
+ yield this.parts.nextButton.click();
57
+ });
58
+ }
59
+ get driverName() {
60
+ return 'MuiV8DataGridPaginationActionDriver';
61
+ }
62
+ }
63
+ exports.DataGridPaginationActionDriver = DataGridPaginationActionDriver;
64
+ //# sourceMappingURL=DataGridPaginationActionDriver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataGridPaginationActionDriver.js","sourceRoot":"","sources":["../../../src/components/datagrid/DataGridPaginationActionDriver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAAyE;AACzE,+CAO8B;AAE9B,MAAM,KAAK,GAAG;IACZ,cAAc,EAAE;QACd,OAAO,EAAE,IAAA,kBAAW,EAAC,YAAY,EAAE,qBAAqB,CAAC;QACzD,MAAM,EAAE,wCAAgB;KACzB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,IAAA,kBAAW,EAAC,YAAY,EAAE,iBAAiB,CAAC;QACrD,MAAM,EAAE,wCAAgB;KACzB;CACkB,CAAC;AAEtB;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sBAA6B;IAC/E,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,gBAAgB,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;YAChE,OAAO,CAAC,UAAU,CAAC;QACrB,CAAC;KAAA;IAEK,gBAAgB;;YACpB,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;YAClD,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC1C,CAAC;KAAA;IAEK,iBAAiB;;YACrB,MAAM,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC5D,OAAO,CAAC,UAAU,CAAC;QACrB,CAAC;KAAA;IAEK,YAAY;;YAChB,MAAM,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC9C,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtC,CAAC;KAAA;IAED,IAAa,UAAU;QACrB,OAAO,qCAAqC,CAAC;IAC/C,CAAC;CACF;AAjCD,wEAiCC"}
@@ -0,0 +1,93 @@
1
+ import { HTMLElementDriver } from '@atomic-testing/component-driver-html';
2
+ import { ComponentDriver, IComponentDriverOption, Interactor, Optional, PartLocator } from '@atomic-testing/core';
3
+ import { DataGridCellQuery } from './DataGridCellQuery';
4
+ import { DataGridFooterDriver } from './DataGridFooterDriver';
5
+ import { DataGridHeaderRowDriver } from './DataGridHeaderRowDriver';
6
+ declare const parts: {
7
+ headerRow: {
8
+ locator: PartLocator;
9
+ driver: typeof DataGridHeaderRowDriver;
10
+ };
11
+ loading: {
12
+ locator: import("@atomic-testing/core").CssLocator;
13
+ driver: typeof HTMLElementDriver;
14
+ };
15
+ skeletonOverlay: {
16
+ locator: import("@atomic-testing/core").CssLocator;
17
+ driver: typeof HTMLElementDriver;
18
+ };
19
+ footer: {
20
+ locator: import("@atomic-testing/core").CssLocator;
21
+ driver: typeof DataGridFooterDriver;
22
+ };
23
+ };
24
+ /**
25
+ * Driver for Material UI v8 DataGridPro component.
26
+ * V8 DataGridPro component does not support data-testid, to use data-testid
27
+ * to locate the component, you need to put the data-testid on the parent element of the grid
28
+ * @see https://mui.com/x/react-data-grid/
29
+ */
30
+ export declare class DataGridProDriver extends ComponentDriver<typeof parts> {
31
+ constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
32
+ /**
33
+ * Checks if the data grid is currently loading.
34
+ * @returns A promise that resolves to a boolean indicating if the data grid is loading.
35
+ */
36
+ isLoading(): Promise<boolean>;
37
+ /**
38
+ * Waits for the data grid to exit the loading state.
39
+ * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.
40
+ */
41
+ waitForLoad(timeoutMs?: number): Promise<void>;
42
+ /**
43
+ * The number of columns currently displayed in the data grid, note that data grid pro
44
+ * uses virtualize rendering, therefore the column count heavily depends on the viewport size
45
+ * @returns The number of columns currently displayed in the data grid
46
+ */
47
+ getColumnCount(): Promise<number>;
48
+ /**
49
+ * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering
50
+ * @returns The array of text of the header row
51
+ */
52
+ getHeaderText(): Promise<string[]>;
53
+ /**
54
+ * The number of rows currently displayed in the data grid, note that data grid pro
55
+ * uses virtualize rendering, therefore the row count heavily depends on the viewport size
56
+ * @returns The number of columns currently displayed in the data grid
57
+ */
58
+ getRowCount(): Promise<number>;
59
+ /**
60
+ * Return the row driver for the row at the specified index, if the row does not exist, return null
61
+ * @param rowIndex
62
+ * @returns
63
+ */
64
+ getRow(rowIndex: number): Promise<DataGridHeaderRowDriver | null>;
65
+ /**
66
+ * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering
67
+ * @param rowIndex The index of the row
68
+ * @returns The array of text of the specified row
69
+ */
70
+ getRowText(rowIndex: number): Promise<string[]>;
71
+ /**
72
+ * Get the cell driver for the cell, if the cell does not exist, return null
73
+ * The cell driver is default to HTMLElementDriver, you can specify a different driver class
74
+ * @param query The query to locate the cell
75
+ * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver
76
+ * @returns
77
+ */
78
+ getCell<DriverT extends ComponentDriver>(query: DataGridCellQuery, driverClass?: typeof ComponentDriver): Promise<DriverT | null>;
79
+ /**
80
+ * Get the text content of the cell, if the cell does not exist, throw an error
81
+ * @param query The query to locate the cell
82
+ * @returns
83
+ */
84
+ getCellText(query: DataGridCellQuery): Promise<string>;
85
+ isFooterVisible(): Promise<boolean>;
86
+ isPreviousPageEnabled(): Promise<boolean>;
87
+ gotoPreviousPage(): Promise<void>;
88
+ isNextPageEnabled(): Promise<boolean>;
89
+ gotoNextPage(): Promise<void>;
90
+ getPaginationDescription(): Promise<Optional<string>>;
91
+ get driverName(): string;
92
+ }
93
+ export {};
@@ -0,0 +1,227 @@
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
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var m = o[Symbol.asyncIterator], i;
14
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.DataGridProDriver = void 0;
20
+ const component_driver_html_1 = require("@atomic-testing/component-driver-html");
21
+ const core_1 = require("@atomic-testing/core");
22
+ const DataGridFooterDriver_1 = require("./DataGridFooterDriver");
23
+ const DataGridHeaderRowDriver_1 = require("./DataGridHeaderRowDriver");
24
+ const parts = {
25
+ headerRow: {
26
+ locator: (0, core_1.byCssClass)('MuiDataGrid-columnHeaders').chain((0, core_1.byCssSelector)('[role=row]:first-of-type')),
27
+ driver: DataGridHeaderRowDriver_1.DataGridHeaderRowDriver,
28
+ },
29
+ loading: {
30
+ locator: (0, core_1.byRole)('progressbar'),
31
+ driver: component_driver_html_1.HTMLElementDriver,
32
+ },
33
+ skeletonOverlay: {
34
+ locator: (0, core_1.byCssClass)('MuiDataGrid-main--hasSkeletonLoadingOverlay'),
35
+ driver: component_driver_html_1.HTMLElementDriver,
36
+ },
37
+ footer: {
38
+ locator: (0, core_1.byCssClass)('MuiDataGrid-footerContainer'),
39
+ driver: DataGridFooterDriver_1.DataGridFooterDriver,
40
+ },
41
+ };
42
+ const dataRowLocator = (0, core_1.byCssSelector)('[role=row][data-rowindex]');
43
+ /**
44
+ * Driver for Material UI v8 DataGridPro component.
45
+ * V8 DataGridPro component does not support data-testid, to use data-testid
46
+ * to locate the component, you need to put the data-testid on the parent element of the grid
47
+ * @see https://mui.com/x/react-data-grid/
48
+ */
49
+ class DataGridProDriver extends core_1.ComponentDriver {
50
+ constructor(locator, interactor, option) {
51
+ super(locator, interactor, Object.assign(Object.assign({}, option), { parts }));
52
+ }
53
+ /**
54
+ * Checks if the data grid is currently loading.
55
+ * @returns A promise that resolves to a boolean indicating if the data grid is loading.
56
+ */
57
+ isLoading() {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const result = yield Promise.all([this.parts.skeletonOverlay.isVisible(), this.parts.loading.isVisible()]);
60
+ return result.some(v => v);
61
+ });
62
+ }
63
+ /**
64
+ * Waits for the data grid to exit the loading state.
65
+ * @param timeoutMs The maximum time to wait for the load to complete, in milliseconds.
66
+ */
67
+ waitForLoad() {
68
+ return __awaiter(this, arguments, void 0, function* (timeoutMs = 10000) {
69
+ yield this.parts.headerRow.waitUntilComponentState();
70
+ yield this.waitUntil({ probeFn: () => this.isLoading(), terminateCondition: false, timeoutMs });
71
+ });
72
+ }
73
+ /**
74
+ * The number of columns currently displayed in the data grid, note that data grid pro
75
+ * uses virtualize rendering, therefore the column count heavily depends on the viewport size
76
+ * @returns The number of columns currently displayed in the data grid
77
+ */
78
+ getColumnCount() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ return this.parts.headerRow.getColumnCount();
81
+ });
82
+ }
83
+ /**
84
+ * The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering
85
+ * @returns The array of text of the header row
86
+ */
87
+ getHeaderText() {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ return this.parts.headerRow.getRowText();
90
+ });
91
+ }
92
+ /**
93
+ * The number of rows currently displayed in the data grid, note that data grid pro
94
+ * uses virtualize rendering, therefore the row count heavily depends on the viewport size
95
+ * @returns The number of columns currently displayed in the data grid
96
+ */
97
+ getRowCount() {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ var _a, e_1, _b, _c;
100
+ const gridRowLocator = core_1.locatorUtil.append(this.locator, dataRowLocator);
101
+ let count = 0;
102
+ try {
103
+ for (var _d = true, _e = __asyncValues(core_1.listHelper.getListItemIterator(this, gridRowLocator, component_driver_html_1.HTMLElementDriver)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
104
+ _c = _f.value;
105
+ _d = false;
106
+ const _ = _c;
107
+ count++;
108
+ }
109
+ }
110
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
111
+ finally {
112
+ try {
113
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
114
+ }
115
+ finally { if (e_1) throw e_1.error; }
116
+ }
117
+ return count;
118
+ });
119
+ }
120
+ /**
121
+ * Return the row driver for the row at the specified index, if the row does not exist, return null
122
+ * @param rowIndex
123
+ * @returns
124
+ */
125
+ getRow(rowIndex) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ const rowLocator = core_1.locatorUtil.append(this.locator, (0, core_1.byCssSelector)(`[role=row][data-rowindex="${rowIndex}"]`));
128
+ const rowExists = yield this.interactor.exists(rowLocator);
129
+ if (rowExists) {
130
+ return new DataGridHeaderRowDriver_1.DataGridHeaderRowDriver(rowLocator, this.interactor, this.commutableOption);
131
+ }
132
+ return null;
133
+ });
134
+ }
135
+ /**
136
+ * The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering
137
+ * @param rowIndex The index of the row
138
+ * @returns The array of text of the specified row
139
+ */
140
+ getRowText(rowIndex) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ const row = yield this.getRow(rowIndex);
143
+ if (row != null) {
144
+ return row.getRowText();
145
+ }
146
+ throw new Error(`Row ${rowIndex} does not exist`);
147
+ });
148
+ }
149
+ /**
150
+ * Get the cell driver for the cell, if the cell does not exist, return null
151
+ * The cell driver is default to HTMLElementDriver, you can specify a different driver class
152
+ * @param query The query to locate the cell
153
+ * @param driverClass Optional, the driver class to use for the cell, default to HTMLElementDriver
154
+ * @returns
155
+ */
156
+ getCell(query_1) {
157
+ return __awaiter(this, arguments, void 0, function* (query,
158
+ // @ts-ignore
159
+ driverClass = component_driver_html_1.HTMLElementDriver) {
160
+ const rowDriver = yield this.getRow(query.rowIndex);
161
+ if (rowDriver === null) {
162
+ return null;
163
+ }
164
+ if ('columnIndex' in query) {
165
+ return rowDriver.getCell(query.columnIndex, driverClass);
166
+ }
167
+ return rowDriver.getCell(query.columnField, driverClass);
168
+ });
169
+ }
170
+ /**
171
+ * Get the text content of the cell, if the cell does not exist, throw an error
172
+ * @param query The query to locate the cell
173
+ * @returns
174
+ */
175
+ getCellText(query) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ var _a;
178
+ const cell = yield this.getCell(query);
179
+ if (cell != null) {
180
+ const text = yield cell.getText();
181
+ return text;
182
+ }
183
+ //@ts-ignore
184
+ throw new Error(`Cell at row:${query.rowIndex} column:${(_a = query.columnIndex) !== null && _a !== void 0 ? _a : query.columnField} does not exist`);
185
+ });
186
+ }
187
+ //#region Footer
188
+ isFooterVisible() {
189
+ return this.parts.footer.isVisible();
190
+ }
191
+ isPreviousPageEnabled() {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ yield this.enforcePartExistence('footer');
194
+ return this.parts.footer.isPreviousPageEnabled();
195
+ });
196
+ }
197
+ gotoPreviousPage() {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ yield this.enforcePartExistence('footer');
200
+ yield this.parts.footer.gotoPreviousPage();
201
+ });
202
+ }
203
+ isNextPageEnabled() {
204
+ return __awaiter(this, void 0, void 0, function* () {
205
+ yield this.enforcePartExistence('footer');
206
+ return this.parts.footer.isNextPageEnabled();
207
+ });
208
+ }
209
+ gotoNextPage() {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ yield this.enforcePartExistence('footer');
212
+ yield this.parts.footer.gotoNextPage();
213
+ });
214
+ }
215
+ getPaginationDescription() {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ yield this.enforcePartExistence('footer');
218
+ return this.parts.footer.getText();
219
+ });
220
+ }
221
+ //#endregion Footer
222
+ get driverName() {
223
+ return 'MuiV8DataGridProDriver';
224
+ }
225
+ }
226
+ exports.DataGridProDriver = DataGridProDriver;
227
+ //# sourceMappingURL=DataGridProDriver.js.map