@agnos-ui/page-objects 0.5.0 → 0.6.0-next.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/lib/index.ts +1 -0
- package/lib/tree.po.ts +46 -0
- package/package.json +3 -3
package/lib/index.ts
CHANGED
package/lib/tree.po.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {BasePO} from '@agnos-ui/base-po';
|
|
2
|
+
import type {Locator} from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
export const treeSelectors = {
|
|
5
|
+
rootComponent: '[role="tree"]',
|
|
6
|
+
itemContainer: '[role="treeitem"]',
|
|
7
|
+
itemToggle: '.au-tree-expand-icon',
|
|
8
|
+
itemContents: '.au-tree-item',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export class TreePO extends BasePO {
|
|
12
|
+
selectors = structuredClone(treeSelectors);
|
|
13
|
+
|
|
14
|
+
override getComponentSelector(): string {
|
|
15
|
+
return this.selectors.rootComponent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get locatorItemToggle(): Locator {
|
|
19
|
+
return this.locatorRoot.locator(this.selectors.itemToggle);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get locatorItemContainer(): Locator {
|
|
23
|
+
return this.locatorRoot.locator(this.selectors.itemContents);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async itemContainerState() {
|
|
27
|
+
return this.locatorRoot.locator(this.selectors.itemContainer).evaluateAll((rootNode: HTMLElement[]) => {
|
|
28
|
+
return rootNode.map((rn) => {
|
|
29
|
+
return {
|
|
30
|
+
ariaSelected: rn.getAttribute('aria-selected'),
|
|
31
|
+
ariaExpanded: rn.getAttribute('aria-expanded'),
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async itemToggleState() {
|
|
38
|
+
return this.locatorRoot.locator(this.selectors.itemToggle).evaluateAll((rootNode: HTMLElement[]) => {
|
|
39
|
+
return rootNode.map((rn) => {
|
|
40
|
+
return {
|
|
41
|
+
ariaLabel: rn.getAttribute('aria-label'),
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnos-ui/page-objects",
|
|
3
3
|
"description": "Page objects to be used when testing AgnosUI-based applications with Playwright.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0-next.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
7
7
|
"page-object",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@agnos-ui/base-po": "0.
|
|
60
|
+
"@agnos-ui/base-po": "0.6.0-next.1"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@playwright/test": "^1.
|
|
63
|
+
"@playwright/test": "^1.49.0"
|
|
64
64
|
},
|
|
65
65
|
"license": "MIT",
|
|
66
66
|
"bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
|