automation_model 1.0.430-dev → 1.0.430

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.
Files changed (60) hide show
  1. package/README.md +130 -0
  2. package/lib/api.d.ts +43 -1
  3. package/lib/api.js +241 -41
  4. package/lib/api.js.map +1 -1
  5. package/lib/auto_page.d.ts +5 -2
  6. package/lib/auto_page.js +177 -46
  7. package/lib/auto_page.js.map +1 -1
  8. package/lib/browser_manager.d.ts +7 -3
  9. package/lib/browser_manager.js +161 -49
  10. package/lib/browser_manager.js.map +1 -1
  11. package/lib/bruno.d.ts +1 -0
  12. package/lib/bruno.js +301 -0
  13. package/lib/bruno.js.map +1 -0
  14. package/lib/command_common.d.ts +6 -0
  15. package/lib/command_common.js +198 -0
  16. package/lib/command_common.js.map +1 -0
  17. package/lib/environment.d.ts +3 -0
  18. package/lib/environment.js +5 -2
  19. package/lib/environment.js.map +1 -1
  20. package/lib/error-messages.d.ts +6 -0
  21. package/lib/error-messages.js +206 -0
  22. package/lib/error-messages.js.map +1 -0
  23. package/lib/generation_scripts.d.ts +4 -0
  24. package/lib/generation_scripts.js +2 -0
  25. package/lib/generation_scripts.js.map +1 -0
  26. package/lib/index.d.ts +2 -0
  27. package/lib/index.js +2 -0
  28. package/lib/index.js.map +1 -1
  29. package/lib/init_browser.d.ts +5 -2
  30. package/lib/init_browser.js +124 -7
  31. package/lib/init_browser.js.map +1 -1
  32. package/lib/locate_element.d.ts +7 -0
  33. package/lib/locate_element.js +215 -0
  34. package/lib/locate_element.js.map +1 -0
  35. package/lib/locator.d.ts +36 -0
  36. package/lib/locator.js +165 -0
  37. package/lib/locator.js.map +1 -1
  38. package/lib/locator_log.d.ts +26 -0
  39. package/lib/locator_log.js +69 -0
  40. package/lib/locator_log.js.map +1 -0
  41. package/lib/network.d.ts +3 -0
  42. package/lib/network.js +183 -0
  43. package/lib/network.js.map +1 -0
  44. package/lib/scripts/axe.mini.js +12 -0
  45. package/lib/stable_browser.d.ts +104 -36
  46. package/lib/stable_browser.js +1802 -1240
  47. package/lib/stable_browser.js.map +1 -1
  48. package/lib/table.d.ts +13 -0
  49. package/lib/table.js +187 -0
  50. package/lib/table.js.map +1 -0
  51. package/lib/table_helper.d.ts +19 -0
  52. package/lib/table_helper.js +116 -0
  53. package/lib/table_helper.js.map +1 -0
  54. package/lib/test_context.d.ts +6 -0
  55. package/lib/test_context.js +14 -10
  56. package/lib/test_context.js.map +1 -1
  57. package/lib/utils.d.ts +22 -2
  58. package/lib/utils.js +664 -11
  59. package/lib/utils.js.map +1 -1
  60. package/package.json +14 -8
package/lib/bruno.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function executeBrunoRequest(requestName: string, options: any, context: any, world: any): Promise<any[] | undefined>;
package/lib/bruno.js ADDED
@@ -0,0 +1,301 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+ import { spawn } from "child_process";
4
+ import { _commandError, _commandFinally, _preCommand } from "./command_common.js";
5
+ import { Types } from "./stable_browser.js";
6
+ export async function executeBrunoRequest(requestName, options, context, world) {
7
+ if (!options) {
8
+ options = {};
9
+ }
10
+ const state = {
11
+ locate: false,
12
+ scroll: false,
13
+ screenshot: false,
14
+ highlight: false,
15
+ throwError: true,
16
+ operation: "bruno",
17
+ text: "bruno " + requestName,
18
+ _text: "bruno " + requestName,
19
+ options: options,
20
+ type: Types.BRUNO,
21
+ world: world,
22
+ };
23
+ await _preCommand(state, context.web);
24
+ const filesToDelete = [];
25
+ try {
26
+ let brunoFolder = options.brunoFolder || path.join(process.cwd(), "bruno");
27
+ if (!brunoFolder) {
28
+ throw new Error("brunoFolder is not defined, place your bruno folder in the current working directory.");
29
+ }
30
+ // generate a temporary folder .tmp under the project root
31
+ const resultFolder = path.join(process.cwd(), ".tmp");
32
+ if (!fs.existsSync(resultFolder)) {
33
+ fs.mkdirSync(resultFolder);
34
+ }
35
+ const runtimeFolder = process.cwd();
36
+ // link node_modules to the runtime folder
37
+ //const nodeModulesFolder = path.join(process.cwd(), "node_modules");
38
+ // if (fs.existsSync(nodeModulesFolder)) {
39
+ // // check if the node_modules folder exists
40
+ // const runtimeNodeModulesFolder = path.join(runtimeFolder, "node_modules");
41
+ // if (!fs.existsSync(runtimeNodeModulesFolder)) {
42
+ // // create a symbolic link to the node_modules folder
43
+ // fs.symlinkSync(nodeModulesFolder, runtimeNodeModulesFolder, "dir");
44
+ // }
45
+ // }
46
+ // identify the bruno file
47
+ const brunoFile = path.join(brunoFolder, `${requestName}.bru`);
48
+ // check if the bruno file exists
49
+ if (!fs.existsSync(brunoFile)) {
50
+ throw new Error(`Bruno file not found: ${brunoFile}`);
51
+ }
52
+ const brunoConfigFile = path.join(brunoFolder, "bruno.json");
53
+ let brunoConfig = {
54
+ version: "1",
55
+ name: "blinq",
56
+ type: "collection",
57
+ ignore: ["node_modules", ".git"],
58
+ };
59
+ // check if the bruno config file exists and copy it to the runtime folder
60
+ if (fs.existsSync(brunoConfigFile)) {
61
+ // read the bruno config file
62
+ brunoConfig = JSON.parse(fs.readFileSync(brunoConfigFile, "utf-8"));
63
+ if (!brunoConfig.scripts) {
64
+ brunoConfig.scripts = {
65
+ filesystemAccess: {
66
+ allow: true,
67
+ },
68
+ };
69
+ }
70
+ }
71
+ const brunoConfigFileName = path.join(runtimeFolder, "bruno.json");
72
+ const brunoConfigFileBackup = path.join(resultFolder, "bruno.json");
73
+ filesToDelete.push(brunoConfigFileName);
74
+ fs.writeFileSync(brunoConfigFileName, JSON.stringify(brunoConfig, null, 2));
75
+ fs.writeFileSync(brunoConfigFileBackup, JSON.stringify(brunoConfig, null, 2));
76
+ let expectRuntime = false;
77
+ // read the bruno file
78
+ let brunoFileContent = fs.readFileSync(brunoFile, "utf-8");
79
+ // populate runtime variables
80
+ brunoFileContent = await context.web._replaceWithLocalData(brunoFileContent, world);
81
+ // inject code to extract runtime variables
82
+ // first find the script:post-response
83
+ const scriptPostResponse = brunoFileContent.indexOf("script:post-response {");
84
+ if (scriptPostResponse !== -1) {
85
+ // need to search a new line follow by }
86
+ // find the end of the script
87
+ const scriptEnd = brunoFileContent.indexOf("\n}", scriptPostResponse);
88
+ // extract the script
89
+ const script = brunoFileContent.substring(scriptPostResponse, scriptEnd + 2);
90
+ // extract all the variables key names: bru.setVar("key", value)
91
+ const regex = /bru\.setVar\("([^"]+)",/g;
92
+ const variables = [];
93
+ let match;
94
+ while ((match = regex.exec(script)) !== null) {
95
+ // check if the variable is already in the list
96
+ if (!variables.includes(match[1])) {
97
+ variables.push(match[1]);
98
+ }
99
+ }
100
+ // check if the variables are not empty
101
+ if (variables.length > 0) {
102
+ expectRuntime = true;
103
+ let scriptVariables = "const runtimeVariables = {};\n";
104
+ // iterate over the variables and create a script to extract them
105
+ for (const variable of variables) {
106
+ scriptVariables += ` runtimeVariables["${variable}"] = bru.getVar("${variable}");\n`;
107
+ }
108
+ // check if the variable is not empty
109
+ // replace the script with the modified one
110
+ brunoFileContent = brunoFileContent.replace(script, `script:post-response {
111
+ const fs = require('fs');
112
+ // inject code to extract runtime variables
113
+ ${script.substring(script.indexOf("{") + 1, script.lastIndexOf("}"))}
114
+ // write the runtime variables to a file
115
+ ${scriptVariables}
116
+ fs.writeFileSync("${path.join(runtimeFolder, "runtime.json")}", JSON.stringify(runtimeVariables, null, 2));
117
+ }`);
118
+ }
119
+ }
120
+ // write the bruno file to the runtime folder
121
+ const executeBruFile = path.join(runtimeFolder, `${requestName}.bru`);
122
+ const executeBruFileBackup = path.join(resultFolder, `${requestName}.bru`);
123
+ filesToDelete.push(executeBruFile);
124
+ fs.writeFileSync(executeBruFile, brunoFileContent);
125
+ fs.writeFileSync(executeBruFileBackup, brunoFileContent);
126
+ const outputFile = path.join(resultFolder, `bruno_${context.web.stepIndex ? context.web.stepIndex : 0}.json`);
127
+ if (fs.existsSync(outputFile)) {
128
+ // remove the file if it exists
129
+ fs.unlinkSync(outputFile);
130
+ }
131
+ // if the runtime.json file exists, remove it
132
+ const runtimeFile = path.join(runtimeFolder, "runtime.json");
133
+ filesToDelete.push(runtimeFile);
134
+ if (fs.existsSync(runtimeFile)) {
135
+ // remove the file if it exists
136
+ fs.unlinkSync(runtimeFile);
137
+ }
138
+ const commandOptions = {
139
+ cwd: runtimeFolder,
140
+ env: {
141
+ ...process.env,
142
+ },
143
+ stdio: "pipe",
144
+ encoding: "utf-8",
145
+ };
146
+ const brunoFilePath = path.join(runtimeFolder, `${requestName}.bru`);
147
+ const args = ["bru", "run", "--reporter-json", outputFile];
148
+ // check if options.brunoArgs is defined
149
+ if (options.brunoArgs) {
150
+ // check if options.brunoArgs is an array
151
+ if (Array.isArray(options.brunoArgs)) {
152
+ // add the args to the command
153
+ args.push(...options.brunoArgs);
154
+ }
155
+ }
156
+ args.push(brunoFilePath);
157
+ const { stdout, stderr } = await runCommand(args, commandOptions);
158
+ // check if the command was successful
159
+ if (!fs.existsSync(outputFile)) {
160
+ if (stderr) {
161
+ console.error(`Error executing Bruno request: ${stderr}`);
162
+ }
163
+ if (stdout) {
164
+ console.log(`Bruno request executed successfully: ${stdout}`);
165
+ }
166
+ throw new Error(`Bruno request failed: ${stderr}`);
167
+ }
168
+ // read the output file
169
+ const result = JSON.parse(fs.readFileSync(outputFile, "utf-8"));
170
+ if (world && world.attach) {
171
+ await world.attach(JSON.stringify(fs.readFileSync(outputFile, "utf-8")), "application/json+bruno");
172
+ }
173
+ if (context.reportFolder) {
174
+ // copy the output file to the report folder
175
+ const reportFile = path.join(context.reportFolder, `bruno_${context.web.stepIndex ? context.web.stepIndex : 0}.json`);
176
+ fs.copyFileSync(outputFile, reportFile);
177
+ }
178
+ // validate result: totlaRequests === passedRequests, totalAssertions === passedAssertions, totalTests === passedTests
179
+ /*
180
+ [
181
+ {
182
+ "iterationIndex": 0,
183
+ "summary": {
184
+ "totalRequests": 1,
185
+ "passedRequests": 1,
186
+ "failedRequests": 0,
187
+ "skippedRequests": 0,
188
+ "totalAssertions": 0,
189
+ "passedAssertions": 0,
190
+ "failedAssertions": 0,
191
+ "totalTests": 1,
192
+ "passedTests": 1,
193
+ "failedTests": 0
194
+ },
195
+ */
196
+ if (result &&
197
+ result.length > 0 &&
198
+ result[0] &&
199
+ result[0].results &&
200
+ result[0].results.length > 0 &&
201
+ result[0].results[0].error) {
202
+ console.error(`Error executing Bruno request: ${result[0].results[0].error}`);
203
+ throw new Error(`Bruno request failed: ${result[0].results[0].error}`);
204
+ }
205
+ if (!result || !Array.isArray(result) || result.length === 0) {
206
+ throw new Error(`Bruno request failed: ${stderr}`);
207
+ }
208
+ const summary = result[0].summary;
209
+ if (summary.totalRequests !== summary.passedRequests) {
210
+ throw new Error(`Bruno request failed: ${stderr}`);
211
+ }
212
+ if (summary.totalAssertions !== summary.passedAssertions) {
213
+ let assertionError = "";
214
+ if (result[0].results && result[0].results.length > 0 && result[0].results[0].assertionResults) {
215
+ for (const assertion of result[0].results[0].assertionResults) {
216
+ if (assertion.error) {
217
+ assertionError += assertion.error + "\n";
218
+ }
219
+ }
220
+ }
221
+ throw new Error(`Bruno request failed: ${assertionError}`);
222
+ }
223
+ let testsError = "";
224
+ if (summary.totalTests !== summary.passedTests) {
225
+ testsError = "";
226
+ if (result[0].results && result[0].results.length > 0 && result[0].results[0].testResults) {
227
+ for (const testResult of result[0].results[0].testResults) {
228
+ if (testResult.error) {
229
+ testsError += testResult.error + "\n";
230
+ }
231
+ }
232
+ }
233
+ throw new Error(`Bruno tests failed: ${testsError}`);
234
+ }
235
+ console.log(requestName + " - request executed successfully");
236
+ console.log(`requests: ${summary.passedRequests}/${summary.totalRequests}`);
237
+ if (summary.totalAssertions > 0) {
238
+ console.log(`assertions: ${summary.passedAssertions}/${summary.totalAssertions}`);
239
+ }
240
+ if (summary.totalTests > 0) {
241
+ console.log(`tests: ${summary.passedTests}/${summary.totalTests}`);
242
+ }
243
+ if (!options.brunoScope) {
244
+ options.brunoScope = "bruno";
245
+ }
246
+ const data = {};
247
+ data[options.testDataScope] = result[0].results.response;
248
+ context.web.setTestData(data, world);
249
+ // if the expectRuntime is true, read the runtime.json file
250
+ if (expectRuntime) {
251
+ // check if the runtime.json file exists
252
+ if (fs.existsSync(runtimeFile)) {
253
+ // read the runtime.json file
254
+ const runtimeData = JSON.parse(fs.readFileSync(runtimeFile, "utf-8"));
255
+ // set test data
256
+ context.web.setTestData(runtimeData, world);
257
+ }
258
+ }
259
+ return result;
260
+ }
261
+ catch (error) {
262
+ await _commandError(state, error, context.web);
263
+ }
264
+ finally {
265
+ // delete the files to delete
266
+ for (const file of filesToDelete) {
267
+ if (fs.existsSync(file)) {
268
+ fs.unlinkSync(file);
269
+ }
270
+ }
271
+ await _commandFinally(state, context.web);
272
+ }
273
+ }
274
+ const runCommand = async (args, options) => {
275
+ return new Promise((resolve, reject) => {
276
+ const _cmd = process.platform === "win32" ? "npx.cmd" : "npx";
277
+ const _options = process.platform === "win32" ? { ...options, shell: true } : options;
278
+ const child = spawn(_cmd, args, _options);
279
+ let stdout = "";
280
+ let stderr = "";
281
+ child.stdout?.on("data", (data) => {
282
+ stdout += data.toString();
283
+ //process.stdout.write(data);
284
+ });
285
+ child.stderr?.on("data", (data) => {
286
+ stderr += data.toString();
287
+ process.stderr.write(data);
288
+ });
289
+ child.on("error", (err) => {
290
+ reject(err);
291
+ });
292
+ child.on("close", (code) => {
293
+ // if (code !== 0) {
294
+ // reject(new Error(`Process exited with code ${code}: ${stderr}`));
295
+ // } else {
296
+ resolve({ stdout, stderr });
297
+ //}
298
+ });
299
+ });
300
+ };
301
+ //# sourceMappingURL=bruno.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bruno.js","sourceRoot":"","sources":["../../src/bruno.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,KAAK,EA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KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAChC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,oBAAoB;YACpB,sEAAsE;YACtE,WAAW;YACX,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5B,GAAG;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function _preCommand(state: any, web: any): Promise<void>;
2
+ export declare function _commandError(state: any, error: any, web: any): Promise<void>;
3
+ export declare function _screenshot(state: any, web: any, specificElement?: any): Promise<void>;
4
+ export declare function _commandFinally(state: any, web: any): Promise<void>;
5
+ export declare function _validateSelectors(selectors: any): void;
6
+ export declare function _reportToWorld(world: any, properties: any): void;
@@ -0,0 +1,198 @@
1
+ import { getHumanReadableErrorMessage } from "./error-messages.js";
2
+ import { LocatorLog } from "./locator_log.js";
3
+ import { _fixUsingParams, maskValue, replaceWithLocalTestData } from "./utils.js";
4
+ export async function _preCommand(state, web) {
5
+ if (!state) {
6
+ return;
7
+ }
8
+ let allowDisabled = false;
9
+ if (state.allowDisabled) {
10
+ allowDisabled = true;
11
+ }
12
+ if (state.locate !== false) {
13
+ state.locate = true;
14
+ }
15
+ if (state.scroll !== false) {
16
+ state.scroll = true;
17
+ }
18
+ if (state.screenshot !== false) {
19
+ state.screenshot = true;
20
+ }
21
+ if (state.highlight !== false) {
22
+ state.highlight = true;
23
+ }
24
+ if (state.throwError !== false) {
25
+ state.throwError = true;
26
+ }
27
+ state.info = {};
28
+ if (state.value) {
29
+ state.value = _fixUsingParams(state.value, state._params);
30
+ state.info.value = state.value;
31
+ }
32
+ if (state.attribute) {
33
+ state.info.attribute = state.attribute;
34
+ }
35
+ if (state.selectors) {
36
+ _validateSelectors(state.selectors);
37
+ const originalSelectors = state.selectors;
38
+ state.selectors = JSON.parse(JSON.stringify(state.selectors));
39
+ if (originalSelectors.frame) {
40
+ state.selectors.frame = originalSelectors.frame;
41
+ }
42
+ }
43
+ state.startTime = Date.now();
44
+ state.info.selectors = state.selectors;
45
+ state.info.log = state.log ? state.log : "";
46
+ if (state.selectors) {
47
+ state.info.locatorLog = new LocatorLog();
48
+ state.info.locatorLog.mission = state.info.log.trim();
49
+ }
50
+ state.info.operation = state.operation;
51
+ state.info.failCause = {};
52
+ state.error = null;
53
+ state.screenshotId = null;
54
+ state.screenshotPath = null;
55
+ if (state.locate === true) {
56
+ let timeout = null;
57
+ if (state.options && state.options.timeout) {
58
+ timeout = state.options.timeout;
59
+ }
60
+ state.element = await web._locate(state.selectors, state.info, state._params, timeout, allowDisabled);
61
+ }
62
+ if (state.scroll === true) {
63
+ await web.scrollIfNeeded(state.element, state.info);
64
+ }
65
+ if (state.screenshot === true) {
66
+ await _screenshot(state, web);
67
+ }
68
+ if (state.highlight === true) {
69
+ try {
70
+ await web._highlightElements(state.element);
71
+ }
72
+ catch (e) {
73
+ // ignore
74
+ }
75
+ }
76
+ state.info.failCause.operationFailed = true;
77
+ }
78
+ export async function _commandError(state, error, web) {
79
+ if (!state.info) {
80
+ state.info = {};
81
+ }
82
+ if (!state.info.failCause) {
83
+ state.info.failCause = {};
84
+ }
85
+ web.logger.error(state.text + " failed");
86
+ if (error && error.message) {
87
+ web.logger.error(error.message);
88
+ }
89
+ if (state.info.locatorLog) {
90
+ const lines = state.info.locatorLog.toString().split("\n");
91
+ for (let line of lines) {
92
+ web.logger.error(line);
93
+ }
94
+ }
95
+ const { screenshotId, screenshotPath } = await web._screenShot(state.options, state.world, state.info);
96
+ state.screenshotId = screenshotId;
97
+ state.screenshotPath = screenshotPath;
98
+ state.info.screenshotPath = screenshotPath;
99
+ // state.info.failCause.error = error;
100
+ state.info.failCause.fail = true;
101
+ const errorClassification = getHumanReadableErrorMessage(error, state.info);
102
+ state.info.errorType = errorClassification.errorType;
103
+ state.info.errorMessage = errorClassification.errorMessage;
104
+ state.info.errorStack = error.stack;
105
+ Object.assign(error, { info: state.info });
106
+ state.error = error;
107
+ state.commandError = true;
108
+ if (state.throwError) {
109
+ throw error;
110
+ }
111
+ }
112
+ export async function _screenshot(state, web, specificElement) {
113
+ // let focusedElement = null;
114
+ // if (specificElement !== undefined) {
115
+ // focusedElement = specificElement;
116
+ // } else {
117
+ // focusedElement = state.element;
118
+ // }
119
+ // const { screenshotId, screenshotPath } = await web._screenShot(
120
+ // state.options,
121
+ // state.world,
122
+ // state.info,
123
+ // focusedElement
124
+ // );
125
+ // ;
126
+ const { screenshotId, screenshotPath } = await web._screenShot(state.options, state.world, state.info);
127
+ state.screenshotId = screenshotId;
128
+ state.screenshotPath = screenshotPath;
129
+ }
130
+ export async function _commandFinally(state, web) {
131
+ if (state && !state.commandError === true) {
132
+ state.info.failCause = {};
133
+ }
134
+ state.endTime = Date.now();
135
+ let _value = "";
136
+ if (state.originalValue) {
137
+ try {
138
+ if (state.originalValue.startsWith("{{") && state.originalValue.endsWith("}}")) {
139
+ _value = (await replaceWithLocalTestData(state.originalValue, state.world, false, true, web.context, web));
140
+ }
141
+ else {
142
+ _value = state.originalValue;
143
+ }
144
+ }
145
+ catch (e) {
146
+ console.error("Error replacing test data value", e);
147
+ _value = state.originalValue;
148
+ }
149
+ }
150
+ const reportObject = {
151
+ element_name: state.selectors ? state.selectors.element_name : null,
152
+ type: state.type,
153
+ text: state.text,
154
+ _text: state._text,
155
+ value: state.originalValue ? maskValue(_value) : state.value,
156
+ screenshotId: state.screenshotId,
157
+ result: state.error
158
+ ? {
159
+ status: "FAILED",
160
+ startTime: state.startTime,
161
+ endTime: state.endTime,
162
+ message: state?.info?.errorMessage ?? state.error?.message,
163
+ stack: state.error?.stack,
164
+ }
165
+ : {
166
+ status: "PASSED",
167
+ startTime: state.startTime,
168
+ endTime: state.endTime,
169
+ },
170
+ info: state.info,
171
+ locatorLog: state.info.locatorLog ? state.info.locatorLog.toString() : null,
172
+ };
173
+ if (state.originalValue && state.info) {
174
+ state.info.value = maskValue(state.originalValue);
175
+ }
176
+ _reportToWorld(state.world, reportObject);
177
+ }
178
+ export function _validateSelectors(selectors) {
179
+ if (!selectors) {
180
+ throw new Error("selectors is null");
181
+ }
182
+ if (!selectors.locators) {
183
+ throw new Error("selectors.locators is null");
184
+ }
185
+ if (!Array.isArray(selectors.locators)) {
186
+ throw new Error("selectors.locators expected to be array");
187
+ }
188
+ if (selectors.locators.length === 0) {
189
+ throw new Error("selectors.locators expected to be non empty array");
190
+ }
191
+ }
192
+ export function _reportToWorld(world, properties) {
193
+ if (!world || !world.attach) {
194
+ return;
195
+ }
196
+ world.attach(JSON.stringify(properties), { mediaType: "application/json" });
197
+ }
198
+ //# sourceMappingURL=command_common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command_common.js","sourceRoot":"","sources":["../../src/command_common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAClF,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAU,EAAE,GAAQ;IACpD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;KACR;IAED,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,KAAK,CAAC,aAAa,EAAE;QACvB,aAAa,GAAG,IAAI,CAAC;KACtB;IACD,IAAI,KAAK,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IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;AACH,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,KAAU,EAAE,UAAe;IACxD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QAC3B,OAAO;KACR;IACD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC9E,CAAC"}
@@ -19,6 +19,9 @@ declare class Environment {
19
19
  extensionPath?: string;
20
20
  constructor(baseUrl?: string | undefined);
21
21
  setBaseUrl(url: string): void;
22
+ apps: {
23
+ [key: string]: Environment;
24
+ };
22
25
  }
23
26
  export { Environment };
24
27
  export type { Cookie, LocalStorage };
@@ -1,12 +1,15 @@
1
1
  class Environment {
2
+ baseUrl;
3
+ cookies = [];
4
+ origins = [];
5
+ extensionPath;
2
6
  constructor(baseUrl) {
3
7
  this.baseUrl = baseUrl;
4
- this.cookies = [];
5
- this.origins = [];
6
8
  }
7
9
  setBaseUrl(url) {
8
10
  this.baseUrl = url;
9
11
  }
12
+ apps = {};
10
13
  }
11
14
  export { Environment };
12
15
  //# sourceMappingURL=environment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW;IAIf,YAAmB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QAHnC,YAAO,GAAa,EAAE,CAAC;QACvB,YAAO,GAAqD,EAAE,CAAC;IAEzB,CAAC;IACvC,UAAU,CAAC,GAAW;QACpB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;CACF;AACD,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW;IAII;IAHnB,OAAO,GAAa,EAAE,CAAC;IACvB,OAAO,GAAqD,EAAE,CAAC;IAC/D,aAAa,CAAU;IACvB,YAAmB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IACvC,UAAU,CAAC,GAAW;QACpB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrB,CAAC;IACD,IAAI,GAAmC,EAAE,CAAC;CAC3C;AACD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ type ErrorClassification = {
2
+ errorType: string;
3
+ errorMessage: string;
4
+ };
5
+ declare const getHumanReadableErrorMessage: (error: Error, info: any) => ErrorClassification;
6
+ export { getHumanReadableErrorMessage };