@checksum-ai/runtime 1.1.18 → 1.1.22
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/checksum-root/.gitignore.example +1 -0
- package/checksum-root/checksum.config.ts +2 -0
- package/checksumlib.js +59 -35
- package/cli.js +30 -30
- package/index.d.ts +79 -20
- package/index.js +63 -63
- package/package.json +2 -1
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PlaywrightWorkerArgs,
|
|
8
8
|
PlaywrightWorkerOptions,
|
|
9
9
|
Locator,
|
|
10
|
+
FrameLocator,
|
|
10
11
|
} from "@playwright/test";
|
|
11
12
|
|
|
12
13
|
interface ChecksumAIMethod {
|
|
@@ -21,26 +22,13 @@ export interface IVariablesStore {
|
|
|
21
22
|
[key: string]: any;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export interface IChecksumPage
|
|
25
|
+
export interface IChecksumPage
|
|
26
|
+
extends Omit<Page, "frameLocator">,
|
|
27
|
+
CompoundSelectionInterface,
|
|
28
|
+
FrameLocatorOwner {
|
|
25
29
|
checksumSelector: (id: string) => IChecksumPage;
|
|
26
30
|
checksumAI: ChecksumAIMethod;
|
|
27
|
-
|
|
28
|
-
* Will create a compound selection that selects an element by grouping multiple locators
|
|
29
|
-
* and find the target element from their common root parent
|
|
30
|
-
*
|
|
31
|
-
* * **Usage**
|
|
32
|
-
*
|
|
33
|
-
* ```js
|
|
34
|
-
* await page.compoundSelection([
|
|
35
|
-
* page.getByText('My first anchor'),
|
|
36
|
-
* page.locator('selector to second anchor')
|
|
37
|
-
* ]).locator("<relative selector to target element>").click();
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @param locators Array of locators to group and calculate the common parent
|
|
41
|
-
* @returns CompoundSelectorLocatorInterface - a locator that will expect a locator method to point the target element
|
|
42
|
-
*/
|
|
43
|
-
compoundSelection: (locators: Locator[]) => CompoundSelectorLocatorInterface;
|
|
31
|
+
|
|
44
32
|
resolveAssetsFolder: (assets: string[]) => string[];
|
|
45
33
|
getPage(index: number): Promise<IChecksumPage>;
|
|
46
34
|
reauthenticate: (role: string) => Promise<void>;
|
|
@@ -54,7 +42,78 @@ export interface IChecksumPage extends Page {
|
|
|
54
42
|
}
|
|
55
43
|
): ChecksumLocator;
|
|
56
44
|
}
|
|
57
|
-
|
|
45
|
+
|
|
46
|
+
export interface CompoundSelectionInterface {
|
|
47
|
+
/**
|
|
48
|
+
* Will create a compound selection that selects elements by grouping multiple locators as anchors
|
|
49
|
+
* and finding the target elements from their common root parent
|
|
50
|
+
*
|
|
51
|
+
* **Usage example**
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* await page.compoundSelection(
|
|
55
|
+
* (base) => [base.getByText("<selector to first anchor>""), page.locator("selector to second anchor"), "<text content of third anchor>"],
|
|
56
|
+
* (base) => base.locator("<relative selector to target element>")
|
|
57
|
+
* ]).first().click();
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @param anchors Method that returns array of locators to group and calculate the common parent from.
|
|
61
|
+
* The method receives the base locator as an argument, which is the locator that the compound selection is called on.
|
|
62
|
+
* The method should return an array of locators or strings that point at the anchor elements.
|
|
63
|
+
* @param target [optional] Method that returns the relative locator or string content that will point at the target element from the common parent
|
|
64
|
+
* that was calculated from the anchors.
|
|
65
|
+
* If no target is provided, the compound selection will return a locator to the common parents.
|
|
66
|
+
*/
|
|
67
|
+
compoundSelection?(
|
|
68
|
+
anchors: (base: Locator) => Array<Locator | string>,
|
|
69
|
+
target?: (base: Locator) => Locator | string
|
|
70
|
+
): Locator;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Will create a compound selection that selects elements by grouping multiple locators as anchors
|
|
74
|
+
* and finding the target elements from their common root parent.
|
|
75
|
+
*
|
|
76
|
+
* **Usage example**
|
|
77
|
+
*
|
|
78
|
+
* ```js
|
|
79
|
+
* await page.compoundSelection({
|
|
80
|
+
* anchors: (base) => [base.getByText("<selector to first anchor>""), page.locator("selector to second anchor"), "<text content of third anchor>"],
|
|
81
|
+
* target?: (base) => base.locator("<relative selector to target element>")
|
|
82
|
+
* }).first().click();
|
|
83
|
+
* ```
|
|
84
|
+
* @param selection
|
|
85
|
+
*/
|
|
86
|
+
compoundSelection?(selection: {
|
|
87
|
+
/**
|
|
88
|
+
* Method that returns array of locators to group and calculate the common parent from.
|
|
89
|
+
* The method should return an array of locators or strings that point at the anchor elements.
|
|
90
|
+
*
|
|
91
|
+
* @param base Base locator that the compound selection is called on.
|
|
92
|
+
*/
|
|
93
|
+
anchors: (base: Locator) => Array<Locator | string>;
|
|
94
|
+
/**
|
|
95
|
+
* Method that returns the relative locator or string content that will point at the target element from the common parent
|
|
96
|
+
* that was calculated from the anchors.
|
|
97
|
+
* If the target is null, the compound selection will return a locator to the common parents.
|
|
98
|
+
*
|
|
99
|
+
* @param base Base locator that the compound selection is called on.
|
|
100
|
+
*/
|
|
101
|
+
target?: (base: Locator) => Locator | string;
|
|
102
|
+
}): Locator;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface FrameLocatorOwner {
|
|
106
|
+
frameLocator: (selector: string) => ChecksumFrameLocator;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ChecksumFrameLocator
|
|
110
|
+
extends FrameLocator,
|
|
111
|
+
CompoundSelectionInterface {}
|
|
112
|
+
|
|
113
|
+
export interface ChecksumLocator
|
|
114
|
+
extends Omit<Locator, "frameLocator">,
|
|
115
|
+
CompoundSelectionInterface,
|
|
116
|
+
FrameLocatorOwner {
|
|
58
117
|
canvasClick: (canvasText: string, rectSizeIndex?: number) => Promise<void>;
|
|
59
118
|
}
|
|
60
119
|
|
|
@@ -232,7 +291,7 @@ type ChecksumTestType<TestArgs> = TestType<
|
|
|
232
291
|
*
|
|
233
292
|
* @param base
|
|
234
293
|
*/
|
|
235
|
-
export function init(base
|
|
294
|
+
export function init(base?: ChecksumTestType<PlaywrightTestArgs>): {
|
|
236
295
|
test: ChecksumTestType<ChecksumPlaywrightTestArgs>;
|
|
237
296
|
login: ReturnType<typeof getLogin>;
|
|
238
297
|
defineChecksumTest: (title: string, testId: string) => string;
|