wdio-ag-grid 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # wdio-ag-grid
2
+
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Update all published packages to declare the Apache-2.0 license and include the
8
+ repository license file for downstream consumers.
9
+ - Updated dependencies
10
+ - @kpmck/ag-grid-core@1.0.1
11
+
12
+ ## 1.0.0
13
+
14
+ ### Major Changes
15
+
16
+ - 2a7e5d7: Move to monorepo structure to support more node-based testing tools for ag grid interactions and validations
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [2a7e5d7]
21
+ - @kpmck/ag-grid-core@1.0.0
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # wdio-ag-grid
2
+
3
+ ![WebdriverIO](./docs/images/webdriverio-logo.png)
4
+
5
+ WebdriverIO helpers for interacting with and validating AG Grid.
6
+
7
+ This package uses the shared `@kpmck/ag-grid-core` logic and exposes a WebdriverIO-friendly wrapper for common AG Grid behaviors.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install wdio-ag-grid --save-dev
13
+ ```
14
+
15
+ Then import the helper in your WebdriverIO tests:
16
+
17
+ ```javascript
18
+ import { createAgGrid, filterOperator, sort } from "wdio-ag-grid";
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Consider the AG Grid example below:
24
+ ![AG Grid](../cypress-ag-grid/ag-grid-example.png)
25
+
26
+ With the following DOM structure:
27
+ ![AG Grid Dom](../cypress-ag-grid/ag-grid-example-dom.png)
28
+
29
+ Create a helper instance from the top-level AG Grid element:
30
+
31
+ ```javascript
32
+ const grid = createAgGrid(await $("#myGrid"));
33
+ ```
34
+
35
+ Read the grid as structured row data:
36
+
37
+ ```javascript
38
+ const grid = createAgGrid(await $("#myGrid"));
39
+ const tableData = await grid.getData();
40
+ ```
41
+
42
+ Filter, sort, and edit cells:
43
+
44
+ ```javascript
45
+ const grid = createAgGrid(await $("#myGrid2"));
46
+
47
+ await grid.filterTextFloating({
48
+ searchCriteria: {
49
+ columnName: "Make",
50
+ filterValue: "Porsche",
51
+ operator: filterOperator.equals,
52
+ },
53
+ hasApplyButton: true,
54
+ });
55
+
56
+ await grid.sortColumn("Model", sort.ascending);
57
+
58
+ const priceCell = await grid.getCellLocator(
59
+ { Make: "Porsche", Price: "72000" },
60
+ "Price"
61
+ );
62
+
63
+ await priceCell.doubleClick();
64
+ await (await priceCell.$("input")).setValue("66000");
65
+ await browser.keys("Enter");
66
+ ```
67
+
68
+ ## Supported Capabilities
69
+
70
+ - get AG Grid data as structured objects
71
+ - return only selected columns
72
+ - sort and pin columns
73
+ - filter by text in menus and floating filters
74
+ - filter by checkbox values
75
+ - toggle columns from the sidebar
76
+ - edit grid cells with returned WDIO elements
77
+ - wait for AG Grid-owned animations to finish
78
+
79
+ ## Monorepo Docs
80
+
81
+ - root landing page: [`README.md`](../../README.md)
82
+ - Cypress package: [`packages/cypress-ag-grid/README.md`](../cypress-ag-grid/README.md)
83
+ - Playwright package: [`packages/playwright-ag-grid/README.md`](../playwright-ag-grid/README.md)
84
+ - shared core: [`packages/ag-grid-core/README.md`](../ag-grid-core/README.md)
Binary file
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "wdio-ag-grid",
3
+ "version": "1.0.1",
4
+ "description": "WebdriverIO helpers for interacting with AG Grid",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "types": "src/index.d.ts",
8
+ "exports": {
9
+ ".": "./src/index.js"
10
+ },
11
+ "scripts": {
12
+ "test": "npm run test:all",
13
+ "test:all": "npm run test:v33 && npm run test:v34 && npm run test:v35",
14
+ "test:v33": "node --test --test-concurrency=1 tests/ag-grid-data.v33.spec.js tests/ag-grid-elements.v33.spec.js",
15
+ "test:v34": "node --test --test-concurrency=1 tests/ag-grid-data.v34.spec.js tests/ag-grid-elements.v34.spec.js",
16
+ "test:v35": "node --test --test-concurrency=1 tests/ag-grid-data.v35.spec.js tests/ag-grid-elements.v35.spec.js tests/ag-grid-animation-wait.v35.spec.js",
17
+ "test:watch": "node --test --watch --test-concurrency=1 tests/ag-grid-data.v33.spec.js tests/ag-grid-data.v34.spec.js tests/ag-grid-data.v35.spec.js tests/ag-grid-elements.v33.spec.js tests/ag-grid-elements.v34.spec.js tests/ag-grid-elements.v35.spec.js tests/ag-grid-animation-wait.v35.spec.js"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/kpmck/cypress-ag-grid.git"
25
+ },
26
+ "keywords": [
27
+ "ag-grid",
28
+ "aggrid",
29
+ "webdriverio",
30
+ "wdio",
31
+ "testing",
32
+ "e2e"
33
+ ],
34
+ "author": "Kerry McKeever <kerry@kerrymckeever.com>",
35
+ "license": "Apache-2.0",
36
+ "dependencies": {
37
+ "@kpmck/ag-grid-core": "1.0.1",
38
+ "chromedriver": "^146.0.6",
39
+ "webdriverio": "^9.27.0"
40
+ }
41
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ export declare const filterOperator: Record<string, string>;
2
+ export declare const sort: Record<string, string>;
3
+
4
+ export interface SearchCriteria {
5
+ columnName: string;
6
+ filterValue: string;
7
+ operator?: string;
8
+ searchInputIndex?: number;
9
+ operatorIndex?: number;
10
+ isMultiFilter?: boolean;
11
+ }
12
+
13
+ export interface FilterOptions {
14
+ searchCriteria: SearchCriteria | SearchCriteria[];
15
+ hasApplyButton?: boolean;
16
+ noMenuTabs?: boolean;
17
+ selectAllLocaleText?: string;
18
+ }
19
+
20
+ export declare class WdioAgGrid {
21
+ constructor(rootElement: any);
22
+ waitForAnimation(options?: object): Promise<void>;
23
+ getData(options?: object): Promise<any>;
24
+ sortColumn(columnName: string, sortDirection: string): Promise<void>;
25
+ pinColumn(columnName: string, pin?: "left" | "right" | null): Promise<void>;
26
+ filterTextMenu(options: FilterOptions): Promise<void>;
27
+ filterTextFloating(options: FilterOptions): Promise<void>;
28
+ filterCheckboxMenu(options: FilterOptions): Promise<void>;
29
+ toggleColumnFromSideBar(columnName: string, doRemove: boolean): Promise<void>;
30
+ getCellLocator(rowMatcher: Record<string, string>, columnName: string): Promise<any>;
31
+ }
32
+
33
+ export declare function createAgGrid(rootElement: any): WdioAgGrid;