@agnos-ui/page-objects 0.6.0-next.1 → 0.6.0-next.2
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/accordion.po.d.ts +45 -0
- package/alert.po.d.ts +21 -0
- package/index.cjs +1 -0
- package/index.js +535 -0
- package/modal.po.d.ts +37 -0
- package/package.json +21 -52
- package/pagination.po.d.ts +80 -0
- package/progressbar.po.d.ts +29 -0
- package/rating.po.d.ts +27 -0
- package/select.po.d.ts +41 -0
- package/slider.po.d.ts +45 -0
- package/toast.po.d.ts +24 -0
- package/tree.po.d.ts +26 -0
- package/lib/accordion.po.ts +0 -93
- package/lib/alert.po.ts +0 -34
- package/lib/modal.po.ts +0 -63
- package/lib/pagination.po.ts +0 -165
- package/lib/progressbar.po.ts +0 -53
- package/lib/rating.po.ts +0 -46
- package/lib/select.po.ts +0 -94
- package/lib/slider.po.ts +0 -73
- package/lib/toast.po.ts +0 -35
- package/lib/tree.po.ts +0 -46
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -9
- package/vite.config.ts +0 -17
- /package/{lib/index.ts → index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,63 +1,31 @@
|
|
|
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.6.0-next.
|
|
4
|
+
"version": "0.6.0-next.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"e2e",
|
|
7
7
|
"page-object",
|
|
8
8
|
"playwright",
|
|
9
|
-
"testing"
|
|
9
|
+
"testing",
|
|
10
|
+
"accordion",
|
|
11
|
+
"AgnosUI",
|
|
12
|
+
"alert",
|
|
13
|
+
"collapse",
|
|
14
|
+
"components",
|
|
15
|
+
"modal",
|
|
16
|
+
"pagination",
|
|
17
|
+
"progressbar",
|
|
18
|
+
"rating",
|
|
19
|
+
"slider",
|
|
20
|
+
"toast",
|
|
21
|
+
"widgets"
|
|
10
22
|
],
|
|
11
23
|
"type": "module",
|
|
12
|
-
"main": "./
|
|
13
|
-
"module": "./
|
|
14
|
-
"types": "./
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "wireit"
|
|
17
|
-
},
|
|
18
|
-
"wireit": {
|
|
19
|
-
"build:src": {
|
|
20
|
-
"command": "vite build && tsc -p tsconfig.build.json",
|
|
21
|
-
"dependencies": [
|
|
22
|
-
"../base-po:build"
|
|
23
|
-
],
|
|
24
|
-
"files": [
|
|
25
|
-
"lib/**",
|
|
26
|
-
"tsconfig.json",
|
|
27
|
-
"../tsconfig.json",
|
|
28
|
-
"vite.config.ts"
|
|
29
|
-
],
|
|
30
|
-
"output": [
|
|
31
|
-
"dist/**",
|
|
32
|
-
"!dist/package.json",
|
|
33
|
-
"!dist/README.md"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"build:pkg": {
|
|
37
|
-
"command": "node ../scripts/buildPackageJson.js . dist",
|
|
38
|
-
"dependencies": [
|
|
39
|
-
"build:src"
|
|
40
|
-
],
|
|
41
|
-
"files": [
|
|
42
|
-
"../scripts/buildPackageJson.js",
|
|
43
|
-
"../package.json",
|
|
44
|
-
"package.json",
|
|
45
|
-
"README.md"
|
|
46
|
-
],
|
|
47
|
-
"output": [
|
|
48
|
-
"dist/README.md",
|
|
49
|
-
"dist/package.json"
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"build": {
|
|
53
|
-
"dependencies": [
|
|
54
|
-
"build:src",
|
|
55
|
-
"build:pkg"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
},
|
|
24
|
+
"main": "./index.cjs",
|
|
25
|
+
"module": "./index.js",
|
|
26
|
+
"types": "./index.d.ts",
|
|
59
27
|
"dependencies": {
|
|
60
|
-
"@agnos-ui/base-po": "0.6.0-next.
|
|
28
|
+
"@agnos-ui/base-po": "0.6.0-next.2"
|
|
61
29
|
},
|
|
62
30
|
"peerDependencies": {
|
|
63
31
|
"@playwright/test": "^1.49.0"
|
|
@@ -68,5 +36,6 @@
|
|
|
68
36
|
"type": "git",
|
|
69
37
|
"url": "git+https://github.com/AmadeusITGroup/AgnosUI.git",
|
|
70
38
|
"directory": "page-objects"
|
|
71
|
-
}
|
|
72
|
-
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://www.agnosui.dev/latest/"
|
|
41
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
2
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
3
|
+
/** Pagination navigation buttons hrefs */
|
|
4
|
+
export interface HrefsNavigation {
|
|
5
|
+
first?: string;
|
|
6
|
+
previous?: string;
|
|
7
|
+
next?: string;
|
|
8
|
+
last?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Pagination page object */
|
|
11
|
+
export interface PaginationPOState {
|
|
12
|
+
rootClasses: string[];
|
|
13
|
+
disabled: string | null;
|
|
14
|
+
pages: string[];
|
|
15
|
+
hrefs: string[];
|
|
16
|
+
hrefsNavigation?: HrefsNavigation;
|
|
17
|
+
isFirstDisabled?: boolean;
|
|
18
|
+
isPreviousDisabled?: boolean;
|
|
19
|
+
isNextDisabled?: boolean;
|
|
20
|
+
isLastDisabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const paginationSelectors: {
|
|
23
|
+
rootComponent: string;
|
|
24
|
+
activePage: string;
|
|
25
|
+
previousPage: string;
|
|
26
|
+
nextPage: string;
|
|
27
|
+
firstPage: string;
|
|
28
|
+
lastPage: string;
|
|
29
|
+
pages: string;
|
|
30
|
+
ellipses: string;
|
|
31
|
+
};
|
|
32
|
+
export declare class PaginationPO extends BasePO {
|
|
33
|
+
selectors: {
|
|
34
|
+
rootComponent: string;
|
|
35
|
+
activePage: string;
|
|
36
|
+
previousPage: string;
|
|
37
|
+
nextPage: string;
|
|
38
|
+
firstPage: string;
|
|
39
|
+
lastPage: string;
|
|
40
|
+
pages: string;
|
|
41
|
+
ellipses: string;
|
|
42
|
+
};
|
|
43
|
+
getComponentSelector(): string;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the locator of the button is the current page in the pagination component.
|
|
46
|
+
*/
|
|
47
|
+
get locatorActivePage(): Locator;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the locator of the button that once clicked moves to the previous page in the pagination component.
|
|
50
|
+
*/
|
|
51
|
+
get locatorPreviousButton(): Locator;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the locator of the button that once clicked moves to the next page in the pagination component.
|
|
54
|
+
*/
|
|
55
|
+
get locatorNextButton(): Locator;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the locator of the button that once clicked moves to the first page in the pagination component.
|
|
58
|
+
*/
|
|
59
|
+
get locatorFirstButton(): Locator;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the locator of the button that once clicked moves to the last page in the pagination component.
|
|
62
|
+
*/
|
|
63
|
+
get locatorLastButton(): Locator;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the locators of the pages
|
|
66
|
+
*/
|
|
67
|
+
get locatorPages(): Locator;
|
|
68
|
+
/**
|
|
69
|
+
* Gets the locator of a page button in the pagination component given his position.
|
|
70
|
+
* @param pageNumber - The number of the page in the pagination object.
|
|
71
|
+
*/
|
|
72
|
+
locatorNthPage(pageNumber: number): Locator;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the locator of a page button in the pagination component given a string.
|
|
75
|
+
* @param pageString - The string of the page in the pagination object.
|
|
76
|
+
*/
|
|
77
|
+
locatorPage(pageString: string): Locator;
|
|
78
|
+
get locatorEllipses(): Locator;
|
|
79
|
+
state(): Promise<PaginationPOState>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
import type { Locator } from '@playwright/test';
|
|
3
|
+
export declare const progressbarSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
outerBar: string;
|
|
6
|
+
innerBar: string;
|
|
7
|
+
};
|
|
8
|
+
export interface State {
|
|
9
|
+
ariaLabel: string | null;
|
|
10
|
+
ariaValueNow: string | null;
|
|
11
|
+
ariaValueMin: string | null;
|
|
12
|
+
ariaValueMax: string | null;
|
|
13
|
+
ariaValueText: string | null;
|
|
14
|
+
label: string | null | undefined;
|
|
15
|
+
innerClasses: string[];
|
|
16
|
+
outerHeight: string | undefined;
|
|
17
|
+
innerWidth: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare class ProgressbarPO extends BasePO {
|
|
20
|
+
selectors: {
|
|
21
|
+
rootComponent: string;
|
|
22
|
+
outerBar: string;
|
|
23
|
+
innerBar: string;
|
|
24
|
+
};
|
|
25
|
+
getComponentSelector(): string;
|
|
26
|
+
get locatorOuterBar(): Locator;
|
|
27
|
+
get locatorInnerBar(): Locator;
|
|
28
|
+
state(): Promise<State>;
|
|
29
|
+
}
|
package/rating.po.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
export declare const ratingSelectors: {
|
|
3
|
+
rootComponent: string;
|
|
4
|
+
star: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class RatingPO extends BasePO {
|
|
7
|
+
selectors: {
|
|
8
|
+
rootComponent: string;
|
|
9
|
+
star: string;
|
|
10
|
+
};
|
|
11
|
+
getComponentSelector(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Get the main title locator of the feature page
|
|
14
|
+
*/
|
|
15
|
+
locatorStar(index: number): import("playwright-core").Locator;
|
|
16
|
+
state(): Promise<{
|
|
17
|
+
rootClasses: string[];
|
|
18
|
+
value: string | null;
|
|
19
|
+
min: string | null;
|
|
20
|
+
max: string | null;
|
|
21
|
+
text: string | null;
|
|
22
|
+
disabled: string | null;
|
|
23
|
+
readonly: string | null;
|
|
24
|
+
stars: string[];
|
|
25
|
+
classes: string[][];
|
|
26
|
+
}>;
|
|
27
|
+
}
|
package/select.po.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
export declare const selectSelectors: {
|
|
3
|
+
rootComponent: string;
|
|
4
|
+
};
|
|
5
|
+
export declare class SelectPO extends BasePO {
|
|
6
|
+
selectors: {
|
|
7
|
+
rootComponent: string;
|
|
8
|
+
};
|
|
9
|
+
getComponentSelector(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get the main title locator of the feature page
|
|
12
|
+
*/
|
|
13
|
+
get locatorInput(): import("playwright-core").Locator;
|
|
14
|
+
/**
|
|
15
|
+
* Menu container
|
|
16
|
+
*/
|
|
17
|
+
get locatorMenu(): import("playwright-core").Locator;
|
|
18
|
+
/**
|
|
19
|
+
* Return the first menu item locator including the text
|
|
20
|
+
*/
|
|
21
|
+
get locatorMenuItems(): import("playwright-core").Locator;
|
|
22
|
+
/**
|
|
23
|
+
* Return the first menu item locator including the text
|
|
24
|
+
*/
|
|
25
|
+
locatorMenuItem(text: string): import("playwright-core").Locator;
|
|
26
|
+
/**
|
|
27
|
+
* Bages container
|
|
28
|
+
*/
|
|
29
|
+
get locatorBadges(): import("playwright-core").Locator;
|
|
30
|
+
/**
|
|
31
|
+
* Return the first badge locator including the text
|
|
32
|
+
*/
|
|
33
|
+
locatorBadgeItem(text: string): import("playwright-core").Locator;
|
|
34
|
+
state(): Promise<{
|
|
35
|
+
text: string;
|
|
36
|
+
badges: (string | undefined)[];
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
list: (string | undefined)[];
|
|
39
|
+
checked: (string | undefined)[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
package/slider.po.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
import type { Locator } from '@playwright/test';
|
|
3
|
+
export declare const sliderSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
clickableArea: string;
|
|
6
|
+
handle: string;
|
|
7
|
+
minLabelHorizontal: string;
|
|
8
|
+
maxLabelHorizontal: string;
|
|
9
|
+
minLabelVertical: string;
|
|
10
|
+
maxLabelVertical: string;
|
|
11
|
+
valueLabel: string;
|
|
12
|
+
progress: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class SliderPO extends BasePO {
|
|
15
|
+
selectors: {
|
|
16
|
+
rootComponent: string;
|
|
17
|
+
clickableArea: string;
|
|
18
|
+
handle: string;
|
|
19
|
+
minLabelHorizontal: string;
|
|
20
|
+
maxLabelHorizontal: string;
|
|
21
|
+
minLabelVertical: string;
|
|
22
|
+
maxLabelVertical: string;
|
|
23
|
+
valueLabel: string;
|
|
24
|
+
progress: string;
|
|
25
|
+
};
|
|
26
|
+
getComponentSelector(): string;
|
|
27
|
+
get locatorHandle(): Locator;
|
|
28
|
+
get locatorMinLabelHorizontal(): Locator;
|
|
29
|
+
get locatorMaxLabelHorizontal(): Locator;
|
|
30
|
+
get locatorMinLabelVertical(): Locator;
|
|
31
|
+
get locatorMaxLabelVertical(): Locator;
|
|
32
|
+
get locatorProgress(): Locator;
|
|
33
|
+
get locatorValueLabel(): Locator;
|
|
34
|
+
sliderHandleState(): Promise<{
|
|
35
|
+
style: string | null;
|
|
36
|
+
value: string | null;
|
|
37
|
+
min: string | null;
|
|
38
|
+
max: string | null;
|
|
39
|
+
disabled: string | null;
|
|
40
|
+
readonly: string | null;
|
|
41
|
+
ariaLabel: string | null;
|
|
42
|
+
ariaValueText: string | null;
|
|
43
|
+
}[]>;
|
|
44
|
+
sliderProgressState(): Promise<(string | null)[]>;
|
|
45
|
+
}
|
package/toast.po.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
2
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
3
|
+
export declare const toastSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
closeButton: string;
|
|
6
|
+
header: string;
|
|
7
|
+
body: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class ToastPO extends BasePO {
|
|
10
|
+
selectors: {
|
|
11
|
+
rootComponent: string;
|
|
12
|
+
closeButton: string;
|
|
13
|
+
header: string;
|
|
14
|
+
body: string;
|
|
15
|
+
};
|
|
16
|
+
getComponentSelector(): string;
|
|
17
|
+
get locatorCloseButton(): Locator;
|
|
18
|
+
state(): Promise<{
|
|
19
|
+
rootClasses: string[];
|
|
20
|
+
body: string | undefined;
|
|
21
|
+
header: string | undefined;
|
|
22
|
+
closeButton: string | null | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
package/tree.po.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BasePO } from '@agnos-ui/base-po';
|
|
2
|
+
import type { Locator } from '@playwright/test';
|
|
3
|
+
export declare const treeSelectors: {
|
|
4
|
+
rootComponent: string;
|
|
5
|
+
itemContainer: string;
|
|
6
|
+
itemToggle: string;
|
|
7
|
+
itemContents: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class TreePO extends BasePO {
|
|
10
|
+
selectors: {
|
|
11
|
+
rootComponent: string;
|
|
12
|
+
itemContainer: string;
|
|
13
|
+
itemToggle: string;
|
|
14
|
+
itemContents: string;
|
|
15
|
+
};
|
|
16
|
+
getComponentSelector(): string;
|
|
17
|
+
get locatorItemToggle(): Locator;
|
|
18
|
+
get locatorItemContainer(): Locator;
|
|
19
|
+
itemContainerState(): Promise<{
|
|
20
|
+
ariaSelected: string | null;
|
|
21
|
+
ariaExpanded: string | null;
|
|
22
|
+
}[]>;
|
|
23
|
+
itemToggleState(): Promise<{
|
|
24
|
+
ariaLabel: string | null;
|
|
25
|
+
}[]>;
|
|
26
|
+
}
|
package/lib/accordion.po.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type {Locator} from '@playwright/test';
|
|
2
|
-
import {BasePO} from '@agnos-ui/base-po';
|
|
3
|
-
|
|
4
|
-
export class AccordionPO extends BasePO {
|
|
5
|
-
private readonly selectors = {
|
|
6
|
-
item: '.accordion-item',
|
|
7
|
-
bodyContainer: '.accordion-collapse',
|
|
8
|
-
body: '.accordion-body',
|
|
9
|
-
header: '.accordion-header',
|
|
10
|
-
buttons: '.accordion-button',
|
|
11
|
-
};
|
|
12
|
-
override getComponentSelector(): string {
|
|
13
|
-
return '.au-accordion';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the locators of the items containing the header and the body-container inside
|
|
18
|
-
* the accordion
|
|
19
|
-
*/
|
|
20
|
-
get locatorAccordionItems(): Locator {
|
|
21
|
-
return this.locatorRoot.locator(this.selectors.item);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Gets the locators of the item specified by the itemIndex containing the header and the body-container inside
|
|
26
|
-
* the accordion
|
|
27
|
-
*/
|
|
28
|
-
locatorAccordionItem(itemIndex: number): Locator {
|
|
29
|
-
return this.locatorRoot.locator(this.selectors.item).nth(itemIndex);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get locatorAccordionCBodyContainers(): Locator {
|
|
33
|
-
return this.locatorAccordionItems.locator(this.selectors.bodyContainer);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
locatorAccordionBodyContainer(bodyContainerIndex: number): Locator {
|
|
37
|
-
return this.locatorAccordionItem(bodyContainerIndex).locator(this.selectors.bodyContainer);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Gets the locator of the bodies of the accordion.
|
|
42
|
-
*/
|
|
43
|
-
get locatorAccordionBodies(): Locator {
|
|
44
|
-
return this.locatorAccordionCBodyContainers.locator(this.selectors.body);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
locatorAccordionBody(bodyIndex: number): Locator {
|
|
48
|
-
return this.locatorAccordionBodyContainer(bodyIndex).locator(this.selectors.body);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get locatorAccordionHeaders(): Locator {
|
|
52
|
-
return this.locatorAccordionItems.locator(this.selectors.header);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
locatorAccordionHeader(headerIndex: number): Locator {
|
|
56
|
-
return this.locatorAccordionItem(headerIndex).locator(this.selectors.header);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Gets the locators of the buttons that handle the accordion, present in the accordion header.
|
|
61
|
-
* It does not get the locators of the buttons present in the body, added by the developer.
|
|
62
|
-
*/
|
|
63
|
-
get locatorAccordionButtons(): Locator {
|
|
64
|
-
return this.locatorAccordionHeaders.locator(this.selectors.buttons);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
locatorAccordionButton(buttonIndex: number): Locator {
|
|
68
|
-
return this.locatorAccordionHeader(buttonIndex).locator(this.selectors.buttons);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async state() {
|
|
72
|
-
return await this.locatorRoot.evaluate((rootNode: HTMLElement) => {
|
|
73
|
-
const itemsElements = [...rootNode.querySelectorAll('.accordion-item')] as HTMLDivElement[];
|
|
74
|
-
const items = [];
|
|
75
|
-
for (const item of itemsElements) {
|
|
76
|
-
const bodyContainer = item.querySelector('.accordion-collapse');
|
|
77
|
-
const button = item.querySelector('.accordion-button');
|
|
78
|
-
items.push({
|
|
79
|
-
classes: item.className.trim().split(' '),
|
|
80
|
-
id: item.id,
|
|
81
|
-
isInDOM: bodyContainer !== null ? true : false,
|
|
82
|
-
bodyContainerId: bodyContainer?.id,
|
|
83
|
-
buttonId: button?.id,
|
|
84
|
-
expanded: button?.getAttribute('aria-expanded'),
|
|
85
|
-
disabled: button?.getAttribute('aria-disabled'),
|
|
86
|
-
labeledBy: bodyContainer?.getAttribute('aria-labelledby'),
|
|
87
|
-
buttonControls: button?.getAttribute('aria-controls'),
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return {rootClasses: rootNode.className.trim().split(' '), items: items};
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
package/lib/alert.po.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {BasePO} from '@agnos-ui/base-po';
|
|
2
|
-
import type {Locator} from '@playwright/test';
|
|
3
|
-
|
|
4
|
-
export const alertSelectors = {
|
|
5
|
-
rootComponent: '.alert',
|
|
6
|
-
body: '.alert-body',
|
|
7
|
-
closeButton: '.btn-close',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export class AlertPO extends BasePO {
|
|
11
|
-
selectors = structuredClone(alertSelectors);
|
|
12
|
-
|
|
13
|
-
override getComponentSelector(): string {
|
|
14
|
-
return this.selectors.rootComponent;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get locatorCloseButton(): Locator {
|
|
18
|
-
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async state() {
|
|
22
|
-
return this.locatorRoot.evaluate((rootNode: HTMLElement, selectors) => {
|
|
23
|
-
// normalize body content to remove non-printable characters such as line breaks
|
|
24
|
-
// as different browsers represent innerText in their own manner
|
|
25
|
-
const body = rootNode.querySelector<HTMLDivElement>(selectors.body)?.innerText?.replace(/[^\x20-\x7E]/g, '');
|
|
26
|
-
const closeButton = rootNode.querySelector<HTMLButtonElement>(selectors.closeButton)?.getAttribute('aria-label');
|
|
27
|
-
return {
|
|
28
|
-
rootClasses: rootNode.className.trim().split(' ').sort(),
|
|
29
|
-
body,
|
|
30
|
-
closeButton,
|
|
31
|
-
};
|
|
32
|
-
}, this.selectors);
|
|
33
|
-
}
|
|
34
|
-
}
|
package/lib/modal.po.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type {Locator} from '@playwright/test';
|
|
2
|
-
import {BasePO} from '@agnos-ui/base-po';
|
|
3
|
-
|
|
4
|
-
export const modalSelectors = {
|
|
5
|
-
// TODO: should we use bootstrap-independent classes starting with au- ?
|
|
6
|
-
rootComponent: '.modal',
|
|
7
|
-
closeButton: '.btn-close',
|
|
8
|
-
backdrop: "xpath=./preceding-sibling::div[contains(@class,'modal-backdrop')]",
|
|
9
|
-
header: '.modal-header',
|
|
10
|
-
title: '.modal-title',
|
|
11
|
-
body: '.modal-body',
|
|
12
|
-
footer: '.modal-footer',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export class ModalPO extends BasePO {
|
|
16
|
-
selectors = structuredClone(modalSelectors);
|
|
17
|
-
|
|
18
|
-
override getComponentSelector(): string {
|
|
19
|
-
return this.selectors.rootComponent;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get locatorHeader(): Locator {
|
|
23
|
-
return this.locatorRoot.locator(this.selectors.header);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get locatorTitle(): Locator {
|
|
27
|
-
return this.locatorHeader.locator(this.selectors.title);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get locatorBody(): Locator {
|
|
31
|
-
return this.locatorRoot.locator(this.selectors.body);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get locatorFooter(): Locator {
|
|
35
|
-
return this.locatorRoot.locator(this.selectors.footer);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
get locatorCloseButton(): Locator {
|
|
39
|
-
return this.locatorRoot.locator(this.selectors.closeButton);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
get locatorBackdrop(): Locator {
|
|
43
|
-
return this.locatorRoot.locator(this.selectors.backdrop);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async state() {
|
|
47
|
-
return this.locatorRoot.evaluate((rootNode: HTMLElement, selectors) => {
|
|
48
|
-
const closeButton = rootNode.querySelector<HTMLButtonElement>(selectors.closeButton)?.getAttribute('aria-label');
|
|
49
|
-
const header = rootNode.querySelector<HTMLDivElement>(selectors.header)?.innerText?.trim();
|
|
50
|
-
const title = rootNode.querySelector<HTMLDivElement>(selectors.title)?.innerText?.trim();
|
|
51
|
-
const body = rootNode.querySelector<HTMLDivElement>(selectors.body)?.innerText?.trim();
|
|
52
|
-
const footer = rootNode.querySelector<HTMLDivElement>(selectors.footer)?.innerText?.trim();
|
|
53
|
-
return {
|
|
54
|
-
rootClasses: rootNode.className.trim().split(' ').sort(),
|
|
55
|
-
header,
|
|
56
|
-
title,
|
|
57
|
-
body,
|
|
58
|
-
footer,
|
|
59
|
-
closeButton,
|
|
60
|
-
};
|
|
61
|
-
}, this.selectors);
|
|
62
|
-
}
|
|
63
|
-
}
|