automation_model 1.0.620-dev → 1.0.620-stage
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/README.md +130 -0
- package/lib/api.js +35 -21
- package/lib/api.js.map +1 -1
- package/lib/auto_page.d.ts +1 -1
- package/lib/auto_page.js +103 -26
- package/lib/auto_page.js.map +1 -1
- package/lib/browser_manager.js +70 -22
- package/lib/browser_manager.js.map +1 -1
- package/lib/bruno.d.ts +2 -0
- package/lib/bruno.js +381 -0
- package/lib/bruno.js.map +1 -0
- package/lib/command_common.d.ts +4 -4
- package/lib/command_common.js +34 -16
- package/lib/command_common.js.map +1 -1
- package/lib/environment.d.ts +1 -0
- package/lib/environment.js +1 -0
- package/lib/environment.js.map +1 -1
- package/lib/file_checker.d.ts +1 -0
- package/lib/file_checker.js +61 -0
- package/lib/file_checker.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/init_browser.d.ts +2 -2
- package/lib/init_browser.js +33 -27
- package/lib/init_browser.js.map +1 -1
- package/lib/locate_element.js +2 -2
- package/lib/locate_element.js.map +1 -1
- package/lib/locator_log.js +3 -0
- package/lib/locator_log.js.map +1 -1
- package/lib/network.d.ts +1 -1
- package/lib/network.js +5 -5
- package/lib/network.js.map +1 -1
- package/lib/snapshot_validation.d.ts +37 -0
- package/lib/snapshot_validation.js +246 -0
- package/lib/snapshot_validation.js.map +1 -0
- package/lib/stable_browser.d.ts +23 -1
- package/lib/stable_browser.js +675 -127
- package/lib/stable_browser.js.map +1 -1
- package/lib/table_helper.d.ts +19 -0
- package/lib/table_helper.js +116 -0
- package/lib/table_helper.js.map +1 -0
- package/lib/test_context.d.ts +2 -0
- package/lib/test_context.js +2 -0
- package/lib/test_context.js.map +1 -1
- package/lib/utils.d.ts +8 -4
- package/lib/utils.js +220 -19
- package/lib/utils.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
export async function highlightSnapshot(snapshot, scope) { }
|
|
2
|
+
/*
|
|
3
|
+
- banner:
|
|
4
|
+
- heading "Shop NOW" [level=6]
|
|
5
|
+
- text: Log In Username
|
|
6
|
+
- textbox "Username"
|
|
7
|
+
- text: Password
|
|
8
|
+
- textbox "Password"
|
|
9
|
+
- button "Login"
|
|
10
|
+
- paragraph: "Accepted usernames are:"
|
|
11
|
+
- list:
|
|
12
|
+
- listitem:
|
|
13
|
+
- paragraph: blinq_user
|
|
14
|
+
- listitem:
|
|
15
|
+
- paragraph: blinq_admin
|
|
16
|
+
- paragraph: "Password for all users:"
|
|
17
|
+
- paragraph: let_me_in
|
|
18
|
+
*/
|
|
19
|
+
class SnapshotNode {
|
|
20
|
+
key;
|
|
21
|
+
value;
|
|
22
|
+
role;
|
|
23
|
+
name;
|
|
24
|
+
children = [];
|
|
25
|
+
parent = null;
|
|
26
|
+
constructor(key, value) {
|
|
27
|
+
this.key = key;
|
|
28
|
+
this.value = value;
|
|
29
|
+
if (!key) {
|
|
30
|
+
throw new Error("Key cannot be null or undefined");
|
|
31
|
+
}
|
|
32
|
+
this.role = key.split(" ")[0];
|
|
33
|
+
if (this.value) {
|
|
34
|
+
this.name = this.value;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// the value will be from the first " to the last "
|
|
38
|
+
const start = key.indexOf('"') + 1;
|
|
39
|
+
const end = key.lastIndexOf('"');
|
|
40
|
+
if (start > -1 && end > -1 && start < end) {
|
|
41
|
+
this.name = key.substring(start, end);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.name = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
generateNodeLocator() {
|
|
49
|
+
let locator = `internal:role=${this.role}`;
|
|
50
|
+
switch (this.role) {
|
|
51
|
+
case "paragraph":
|
|
52
|
+
// internal:role=paragraph >> internal:text='blinq_user'"
|
|
53
|
+
return `internal:role=${this.role} >> internal:text='${this.name}'`;
|
|
54
|
+
default:
|
|
55
|
+
// "internal:role=textbox[name=\"Password\"]"
|
|
56
|
+
if (this.name) {
|
|
57
|
+
locator += `[name="${this.name}"]`;
|
|
58
|
+
}
|
|
59
|
+
return locator;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getFullLocator() {
|
|
63
|
+
// create an array of all the parents and current node locators
|
|
64
|
+
const locators = [];
|
|
65
|
+
let currentNode = this;
|
|
66
|
+
while (currentNode) {
|
|
67
|
+
locators.unshift(currentNode.generateNodeLocator());
|
|
68
|
+
currentNode = currentNode.parent;
|
|
69
|
+
}
|
|
70
|
+
// join the locators with " >> "
|
|
71
|
+
return locators.join(" >> ");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function fromLinesToSnapshotLines(lines) {
|
|
75
|
+
// the input is yaml text split into lines, 2 spaces is 1 level
|
|
76
|
+
const nodes = [];
|
|
77
|
+
for (let i = 0; i < lines.length; i++) {
|
|
78
|
+
const line = lines[i];
|
|
79
|
+
const trimmedLine = line.trim();
|
|
80
|
+
if (trimmedLine.length === 0) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// count the number of leading spaces
|
|
84
|
+
let level = 0;
|
|
85
|
+
const match = line.match(/^ */); // Matches spaces at the beginning
|
|
86
|
+
const count = match ? match[0].length : 0;
|
|
87
|
+
level = count / 2; // 2 spaces is 1 level
|
|
88
|
+
// find the start of the line: - and space
|
|
89
|
+
const start = line.indexOf("- ") + 2;
|
|
90
|
+
if (start === -1) {
|
|
91
|
+
// no - found, set it to error
|
|
92
|
+
nodes.push({
|
|
93
|
+
line: i,
|
|
94
|
+
line_text: line,
|
|
95
|
+
key: line,
|
|
96
|
+
value: null,
|
|
97
|
+
level,
|
|
98
|
+
error: "No - found",
|
|
99
|
+
regex: false,
|
|
100
|
+
});
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
// first we need to extract the role, we should find the first space or : after the start
|
|
104
|
+
const end = line.indexOf(" ", start);
|
|
105
|
+
const end2 = line.indexOf(":", start);
|
|
106
|
+
if (end === -1 && end2 === -1) {
|
|
107
|
+
// no space or : found, set it to error
|
|
108
|
+
nodes.push({
|
|
109
|
+
line: i,
|
|
110
|
+
line_text: line,
|
|
111
|
+
key: line,
|
|
112
|
+
value: null,
|
|
113
|
+
level,
|
|
114
|
+
error: "No space or : found",
|
|
115
|
+
regex: false,
|
|
116
|
+
});
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const endIndex = end === -1 ? end2 : end2 === -1 ? end : Math.min(end, end2);
|
|
120
|
+
const key = line.substring(start, endIndex).trim();
|
|
121
|
+
// define value is string or null
|
|
122
|
+
let value = line.substring(endIndex + 1).trim();
|
|
123
|
+
if (value.startsWith('"')) {
|
|
124
|
+
// find the last " in the value
|
|
125
|
+
const lastQuote = value.lastIndexOf('"');
|
|
126
|
+
if (lastQuote !== -1) {
|
|
127
|
+
value = value.substring(0, lastQuote + 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// check if the value start with / and end with / or / + regex options
|
|
131
|
+
const regex = value.startsWith("/") && (value.endsWith("/") || value.endsWith("/i") || value.endsWith("/g"));
|
|
132
|
+
nodes.push({
|
|
133
|
+
line: i,
|
|
134
|
+
line_text: line,
|
|
135
|
+
key,
|
|
136
|
+
value: value.length > 0 ? value : null,
|
|
137
|
+
level,
|
|
138
|
+
error: null,
|
|
139
|
+
regex,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return nodes;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Turn a “/pattern/flags” string into a real RegExp.
|
|
146
|
+
*/
|
|
147
|
+
function toRegExp(raw) {
|
|
148
|
+
if (!raw.startsWith("/"))
|
|
149
|
+
return new RegExp(raw); // plain text
|
|
150
|
+
const lastSlash = raw.lastIndexOf("/");
|
|
151
|
+
const pattern = raw.slice(1, lastSlash); // between the //
|
|
152
|
+
const flags = raw.slice(lastSlash + 1); // i, g, …
|
|
153
|
+
return new RegExp(pattern, flags);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Single-line comparison with fixed regex handling.
|
|
157
|
+
*/
|
|
158
|
+
function lineMatches(full, sub) {
|
|
159
|
+
if (full.key !== sub.key)
|
|
160
|
+
return false;
|
|
161
|
+
if (full.level !== sub.level)
|
|
162
|
+
return false;
|
|
163
|
+
if (sub.value === null)
|
|
164
|
+
return true; // “match anything”
|
|
165
|
+
return sub.regex ? toRegExp(sub.value).test(full.value ?? "") : full.value === sub.value;
|
|
166
|
+
}
|
|
167
|
+
export function snapshotValidation(snapshot, referanceSnapshot, snapshotName) {
|
|
168
|
+
const lines = snapshot.split("\n");
|
|
169
|
+
const nodes = fromLinesToSnapshotLines(lines);
|
|
170
|
+
const subLines = referanceSnapshot.split("\n");
|
|
171
|
+
const subNodes = fromLinesToSnapshotLines(subLines);
|
|
172
|
+
return matchSnapshot(nodes, subNodes, snapshotName);
|
|
173
|
+
}
|
|
174
|
+
export function matchSnapshot(full, sub, snapshotName) {
|
|
175
|
+
/* nearest ancestor of every sub-line (–1 for roots) */
|
|
176
|
+
const parentIdx = sub.map((_, i) => {
|
|
177
|
+
for (let j = i - 1; j >= 0; j--)
|
|
178
|
+
if (sub[j].level < sub[i].level)
|
|
179
|
+
return j;
|
|
180
|
+
return -1;
|
|
181
|
+
});
|
|
182
|
+
const fullIdx = new Array(sub.length); // indices in `full`
|
|
183
|
+
const mapping = new Array(sub.length); // original line #s
|
|
184
|
+
let failureAt = -1; // first unmatched line
|
|
185
|
+
/**
|
|
186
|
+
* Depth-first search with back-tracking.
|
|
187
|
+
* @param s index in `sub`
|
|
188
|
+
* @param fFrom first index in `full` we may try for this `sub[s]`
|
|
189
|
+
*/
|
|
190
|
+
function dfs(s, fFrom) {
|
|
191
|
+
if (s === sub.length)
|
|
192
|
+
return true; // ✅ all lines matched!
|
|
193
|
+
for (let f = fFrom; f < full.length; f++) {
|
|
194
|
+
if (!lineMatches(full[f], sub[s]))
|
|
195
|
+
continue;
|
|
196
|
+
/* parent relationship must stay intact */
|
|
197
|
+
const pSub = parentIdx[s];
|
|
198
|
+
if (pSub !== -1) {
|
|
199
|
+
let pFull = f - 1;
|
|
200
|
+
while (pFull >= 0 && full[pFull].level >= full[f].level)
|
|
201
|
+
pFull--;
|
|
202
|
+
if (pFull < 0 || pFull !== fullIdx[pSub])
|
|
203
|
+
continue; // wrong parent
|
|
204
|
+
}
|
|
205
|
+
/* remember this choice and try deeper */
|
|
206
|
+
fullIdx[s] = f;
|
|
207
|
+
mapping[s] = full[f].line;
|
|
208
|
+
if (dfs(s + 1, f + 1))
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
/* could not satisfy sub[s] → remember where we failed */
|
|
212
|
+
if (failureAt === -1)
|
|
213
|
+
failureAt = s;
|
|
214
|
+
return false; // back-track
|
|
215
|
+
}
|
|
216
|
+
/* kick off the search */
|
|
217
|
+
const found = dfs(0, 0);
|
|
218
|
+
let error = null;
|
|
219
|
+
if (!found) {
|
|
220
|
+
error = `Error missmatch snapshot\n${snapshotName}: ${sub[failureAt].line}\nLine: ${sub[failureAt].line_text}`;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
matchingLines: found ? mapping : mapping.slice(0, failureAt),
|
|
224
|
+
errorLine: found ? -1 : failureAt,
|
|
225
|
+
errorLineText: error,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// let ttt = `- banner:
|
|
229
|
+
// - heading "Shop NOW" [level=6]
|
|
230
|
+
// - text: Log In Username
|
|
231
|
+
// - textbox "Username"
|
|
232
|
+
// - text: Password
|
|
233
|
+
// - textbox "Password"
|
|
234
|
+
// - button "Login"
|
|
235
|
+
// - paragraph: "Accepted usernames are:"
|
|
236
|
+
// - list:
|
|
237
|
+
// - listitem:
|
|
238
|
+
// - paragraph: blinq_user
|
|
239
|
+
// - listitem:
|
|
240
|
+
// - paragraph: blinq_admin
|
|
241
|
+
// - paragraph: "Password for all users:"
|
|
242
|
+
// - paragraph: let_me_in`;
|
|
243
|
+
// const lines = ttt.split("\n");
|
|
244
|
+
// const nodes = fromLinesToSnapshotLines(lines);
|
|
245
|
+
// console.log("nodes", nodes);
|
|
246
|
+
//# sourceMappingURL=snapshot_validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot_validation.js","sourceRoot":"","sources":["../../src/snapshot_validation.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAa,EAAE,KAAU,IAAG,CAAC;AAErE;;;;;;;;;;;;;;;;EAgBE;AACF,MAAM,YAAY;IAMP;IACA;IANF,IAAI,CAAS;IACb,IAAI,CAAgB;IACpB,QAAQ,GAAmB,EAAE,CAAC;IAC9B,MAAM,GAAwB,IAAI,CAAC;IAC1C,YACS,GAAW,EACX,KAAa;QADb,QAAG,GAAH,GAAG,CAAQ;QACX,UAAK,GAAL,KAAK,CAAQ;QAEpB,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;SACxB;aAAM;YACL,mDAAmD;YACnD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE;gBACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;aACvC;iBAAM;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B,yCAAyC;AACzC,2BAA2B;AAC3B,iCAAiC;AACjC,iDAAiD;AACjD,+BAA+B"}
|
package/lib/stable_browser.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Browser, Page } from "playwright";
|
|
|
2
2
|
import { Params } from "./utils.js";
|
|
3
3
|
export declare const Types: {
|
|
4
4
|
CLICK: string;
|
|
5
|
+
WAIT_ELEMENT: string;
|
|
5
6
|
NAVIGATE: string;
|
|
6
7
|
FILL: string;
|
|
7
8
|
EXECUTE: string;
|
|
@@ -23,6 +24,7 @@ export declare const Types: {
|
|
|
23
24
|
UNCHECK: string;
|
|
24
25
|
EXTRACT: string;
|
|
25
26
|
CLOSE_PAGE: string;
|
|
27
|
+
TABLE_OPERATION: string;
|
|
26
28
|
SET_DATE_TIME: string;
|
|
27
29
|
SET_VIEWPORT: string;
|
|
28
30
|
VERIFY_VISUAL: string;
|
|
@@ -31,6 +33,10 @@ export declare const Types: {
|
|
|
31
33
|
WAIT_FOR_TEXT_TO_DISAPPEAR: string;
|
|
32
34
|
VERIFY_ATTRIBUTE: string;
|
|
33
35
|
VERIFY_TEXT_WITH_RELATION: string;
|
|
36
|
+
BRUNO: string;
|
|
37
|
+
VERIFY_FILE_EXISTS: string;
|
|
38
|
+
SET_INPUT_FILES: string;
|
|
39
|
+
SNAPSHOT_VALIDATION: string;
|
|
34
40
|
};
|
|
35
41
|
export declare const apps: {};
|
|
36
42
|
declare class StableBrowser {
|
|
@@ -46,9 +52,11 @@ declare class StableBrowser {
|
|
|
46
52
|
appName: string;
|
|
47
53
|
tags: null;
|
|
48
54
|
isRecording: boolean;
|
|
55
|
+
initSnapshotTaken: boolean;
|
|
49
56
|
constructor(browser: Browser, page: Page, logger?: any, context?: any, world?: any);
|
|
50
57
|
registerEventListeners(context: any): void;
|
|
51
58
|
switchApp(appName: any): Promise<void>;
|
|
59
|
+
switchTab(tabTitleOrIndex: number | string): Promise<void>;
|
|
52
60
|
registerConsoleLogListener(page: Page, context: any): void;
|
|
53
61
|
registerRequestListener(page: Page, context: any, logFile: string): void;
|
|
54
62
|
goto(url: string, world?: null): Promise<void>;
|
|
@@ -72,6 +80,7 @@ declare class StableBrowser {
|
|
|
72
80
|
simpleClick(elementDescription: any, _params?: Params, options?: {}, world?: null): Promise<void>;
|
|
73
81
|
simpleClickType(elementDescription: any, value: any, _params?: Params, options?: {}, world?: null): Promise<void>;
|
|
74
82
|
click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
|
|
83
|
+
waitForElement(selectors: any, _params?: Params, options?: {}, world?: null): Promise<boolean>;
|
|
75
84
|
setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<any>;
|
|
76
85
|
hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
|
|
77
86
|
selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
@@ -80,6 +89,7 @@ declare class StableBrowser {
|
|
|
80
89
|
setDateTime(selectors: any, value: any, format?: null, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
81
90
|
clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
82
91
|
fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
92
|
+
setInputFiles(selectors: any, files: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
83
93
|
getText(selectors: any, _params?: null, options?: {}, info?: {}, world?: null): Promise<{
|
|
84
94
|
text: any;
|
|
85
95
|
screenshotId: any;
|
|
@@ -108,8 +118,10 @@ declare class StableBrowser {
|
|
|
108
118
|
}>;
|
|
109
119
|
containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
110
120
|
containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
121
|
+
snapshotValidation(frameSelectors: any, referanceSnapshot: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
111
122
|
waitForUserInput(message: any, world?: null): Promise<void>;
|
|
112
123
|
setTestData(testData: any, world?: null): void;
|
|
124
|
+
overwriteTestData(testData: any, world?: null): void;
|
|
113
125
|
_getDataFilePath(fileName: any): string;
|
|
114
126
|
_parseCSVSync(filePath: any): Promise<unknown>;
|
|
115
127
|
loadTestData(type: string, dataSelector: string, world?: null): {
|
|
@@ -130,28 +142,38 @@ declare class StableBrowser {
|
|
|
130
142
|
}>;
|
|
131
143
|
_highlightElements(scope: any, css: any): Promise<void>;
|
|
132
144
|
verifyPagePath(pathPart: any, options?: {}, world?: null): Promise<{} | undefined>;
|
|
133
|
-
|
|
145
|
+
verifyPageTitle(title: any, options?: {}, world?: null): Promise<{} | undefined>;
|
|
146
|
+
findTextInAllFrames(dateAlternatives: any, numberAlternatives: any, text: any, state: any, partial?: boolean, ignoreCase?: boolean): Promise<{
|
|
134
147
|
elementCount: number;
|
|
135
148
|
randomToken: string;
|
|
136
149
|
}[]>;
|
|
137
150
|
verifyTextExistInPage(text: any, options?: {}, world?: null): Promise<any>;
|
|
138
151
|
waitForTextToDisappear(text: any, options?: {}, world?: null): Promise<any>;
|
|
139
152
|
verifyTextRelatedToText(textAnchor: string, climb: number, textToVerify: string, options?: {}, world?: any): Promise<any>;
|
|
153
|
+
findRelatedTextInAllFrames(textAnchor: string, climb: number, textToVerify: string, params?: Params, options?: {}, world?: any): Promise<{
|
|
154
|
+
elementCount: number;
|
|
155
|
+
randomToken: string;
|
|
156
|
+
}[]>;
|
|
140
157
|
visualVerification(text: any, options?: {}, world?: null): Promise<{} | undefined>;
|
|
141
158
|
verifyTableData(selectors: any, data: any, _params?: null, options?: {}, world?: null): Promise<void>;
|
|
142
159
|
getTableData(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
143
160
|
analyzeTable(selectors: any, query: any, operator: any, value: any, _params?: null, options?: {}, world?: null): Promise<{} | undefined>;
|
|
144
161
|
_replaceWithLocalData(value: any, world: any, _decrypt?: boolean, totpWait?: boolean): Promise<string>;
|
|
145
162
|
_getLoadTimeout(options: any): number;
|
|
163
|
+
_getFindElementTimeout(options: any): any;
|
|
146
164
|
saveStoreState(path?: string | null, world?: any): Promise<void>;
|
|
147
165
|
restoreSaveState(path?: string | null, world?: any): Promise<void>;
|
|
148
166
|
waitForPageLoad(options?: {}, world?: null): Promise<void>;
|
|
149
167
|
closePage(options?: {}, world?: null): Promise<void>;
|
|
168
|
+
tableCellOperation(headerText: string, rowText: string, options: any, _params: Params, world?: null): Promise<void>;
|
|
150
169
|
saveTestDataAsGlobal(options: any, world: any): void;
|
|
151
170
|
setViewportSize(width: number, hight: number, options?: {}, world?: null): Promise<void>;
|
|
152
171
|
reloadPage(options?: {}, world?: null): Promise<void>;
|
|
153
172
|
scrollIfNeeded(element: any, info: any): Promise<void>;
|
|
173
|
+
beforeScenario(world: any, scenario: any): Promise<void>;
|
|
174
|
+
afterScenario(world: any, scenario: any): Promise<void>;
|
|
154
175
|
beforeStep(world: any, step: any): Promise<void>;
|
|
176
|
+
getAriaSnapshot(): Promise<string | null>;
|
|
155
177
|
afterStep(world: any, step: any): Promise<void>;
|
|
156
178
|
}
|
|
157
179
|
type JsonTimestamp = number;
|