automation_model 1.0.447-dev → 1.0.447

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 (71) hide show
  1. package/README.md +130 -0
  2. package/lib/analyze_helper.js.map +1 -1
  3. package/lib/api.d.ts +43 -2
  4. package/lib/api.js +239 -49
  5. package/lib/api.js.map +1 -1
  6. package/lib/auto_page.d.ts +5 -2
  7. package/lib/auto_page.js +231 -49
  8. package/lib/auto_page.js.map +1 -1
  9. package/lib/browser_manager.d.ts +7 -3
  10. package/lib/browser_manager.js +172 -48
  11. package/lib/browser_manager.js.map +1 -1
  12. package/lib/bruno.d.ts +2 -0
  13. package/lib/bruno.js +381 -0
  14. package/lib/bruno.js.map +1 -0
  15. package/lib/command_common.d.ts +6 -0
  16. package/lib/command_common.js +202 -0
  17. package/lib/command_common.js.map +1 -0
  18. package/lib/date_time.js.map +1 -1
  19. package/lib/drawRect.js.map +1 -1
  20. package/lib/environment.d.ts +1 -0
  21. package/lib/environment.js +6 -3
  22. package/lib/environment.js.map +1 -1
  23. package/lib/error-messages.d.ts +6 -0
  24. package/lib/error-messages.js +206 -0
  25. package/lib/error-messages.js.map +1 -0
  26. package/lib/file_checker.d.ts +1 -0
  27. package/lib/file_checker.js +61 -0
  28. package/lib/file_checker.js.map +1 -0
  29. package/lib/find_function.js.map +1 -1
  30. package/lib/generation_scripts.d.ts +4 -0
  31. package/lib/generation_scripts.js +2 -0
  32. package/lib/generation_scripts.js.map +1 -0
  33. package/lib/index.d.ts +3 -0
  34. package/lib/index.js +3 -0
  35. package/lib/index.js.map +1 -1
  36. package/lib/init_browser.d.ts +4 -2
  37. package/lib/init_browser.js +118 -12
  38. package/lib/init_browser.js.map +1 -1
  39. package/lib/locate_element.d.ts +7 -0
  40. package/lib/locate_element.js +215 -0
  41. package/lib/locate_element.js.map +1 -0
  42. package/lib/locator.d.ts +37 -0
  43. package/lib/locator.js +172 -0
  44. package/lib/locator.js.map +1 -1
  45. package/lib/locator_log.d.ts +26 -0
  46. package/lib/locator_log.js +69 -0
  47. package/lib/locator_log.js.map +1 -0
  48. package/lib/network.d.ts +3 -0
  49. package/lib/network.js +183 -0
  50. package/lib/network.js.map +1 -0
  51. package/lib/scripts/axe.mini.js +12 -0
  52. package/lib/snapshot_validation.d.ts +37 -0
  53. package/lib/snapshot_validation.js +357 -0
  54. package/lib/snapshot_validation.js.map +1 -0
  55. package/lib/stable_browser.d.ts +148 -57
  56. package/lib/stable_browser.js +2389 -1313
  57. package/lib/stable_browser.js.map +1 -1
  58. package/lib/table.d.ts +15 -0
  59. package/lib/table.js +257 -0
  60. package/lib/table.js.map +1 -0
  61. package/lib/table_analyze.js.map +1 -1
  62. package/lib/table_helper.d.ts +19 -0
  63. package/lib/table_helper.js +116 -0
  64. package/lib/table_helper.js.map +1 -0
  65. package/lib/test_context.d.ts +7 -0
  66. package/lib/test_context.js +15 -10
  67. package/lib/test_context.js.map +1 -1
  68. package/lib/utils.d.ts +22 -2
  69. package/lib/utils.js +678 -11
  70. package/lib/utils.js.map +1 -1
  71. package/package.json +20 -11
@@ -1,49 +1,100 @@
1
1
  import type { Browser, Page } from "playwright";
2
- type Params = Record<string, string>;
2
+ import { Params } from "./utils.js";
3
+ export declare const Types: {
4
+ CLICK: string;
5
+ WAIT_ELEMENT: string;
6
+ NAVIGATE: string;
7
+ FILL: string;
8
+ EXECUTE: string;
9
+ OPEN: string;
10
+ COMPLETE: string;
11
+ ASK: string;
12
+ GET_PAGE_STATUS: string;
13
+ CLICK_ROW_ACTION: string;
14
+ VERIFY_ELEMENT_CONTAINS_TEXT: string;
15
+ VERIFY_PAGE_CONTAINS_TEXT: string;
16
+ VERIFY_PAGE_CONTAINS_NO_TEXT: string;
17
+ ANALYZE_TABLE: string;
18
+ SELECT: string;
19
+ VERIFY_PAGE_PATH: string;
20
+ VERIFY_PAGE_TITLE: string;
21
+ TYPE_PRESS: string;
22
+ PRESS: string;
23
+ HOVER: string;
24
+ CHECK: string;
25
+ UNCHECK: string;
26
+ EXTRACT: string;
27
+ CLOSE_PAGE: string;
28
+ TABLE_OPERATION: string;
29
+ SET_DATE_TIME: string;
30
+ SET_VIEWPORT: string;
31
+ VERIFY_VISUAL: string;
32
+ LOAD_DATA: string;
33
+ SET_INPUT: string;
34
+ WAIT_FOR_TEXT_TO_DISAPPEAR: string;
35
+ VERIFY_ATTRIBUTE: string;
36
+ VERIFY_TEXT_WITH_RELATION: string;
37
+ BRUNO: string;
38
+ VERIFY_FILE_EXISTS: string;
39
+ SET_INPUT_FILES: string;
40
+ SNAPSHOT_VALIDATION: string;
41
+ REPORT_COMMAND: string;
42
+ STEP_COMPLETE: string;
43
+ SLEEP: string;
44
+ };
3
45
  export declare const apps: {};
4
46
  declare class StableBrowser {
5
47
  browser: Browser;
6
48
  page: Page;
7
49
  logger: any;
8
50
  context: any;
51
+ world?: any;
52
+ fastMode: boolean;
9
53
  project_path: null;
10
54
  webLogFile: null;
55
+ networkLogger: null;
11
56
  configuration: null;
12
57
  appName: string;
13
- constructor(browser: Browser, page: Page, logger?: any, context?: any);
58
+ tags: null;
59
+ isRecording: boolean;
60
+ initSnapshotTaken: boolean;
61
+ constructor(browser: Browser, page: Page, logger?: any, context?: any, world?: any, fastMode?: boolean);
14
62
  registerEventListeners(context: any): void;
15
63
  switchApp(appName: any): Promise<void>;
16
- _copyContext(from: any, to: any): void;
17
- getWebLogFile(logFolder: string): string;
18
- registerConsoleLogListener(page: Page, context: any, logFile: string): void;
19
- registerRequestListener(): void;
20
- goto(url: string): Promise<void>;
21
- _validateSelectors(selectors: any): void;
22
- _fixUsingParams(text: any, _params: Params): any;
23
- _fixLocatorUsingParams(locator: any, _params: Params): any;
24
- _isObject(value: any): any;
25
- scanAndManipulate(currentObj: any, _params: Params): void;
26
- _getLocator(locator: any, scope: any, _params: any): any;
64
+ switchTab(tabTitleOrIndex: number | string): Promise<void>;
65
+ registerConsoleLogListener(page: Page, context: any): void;
66
+ registerRequestListener(page: Page, context: any, logFile: string): void;
67
+ goto(url: string, world?: null): Promise<void>;
68
+ _getLocator(locator: any, scope: any, _params: any): Promise<any>;
27
69
  _locateElmentByTextClimbCss(scope: any, text: any, climb: any, css: any, _params: Params): Promise<string | undefined>;
28
- _locateElementByText(scope: any, text1: any, tag1: any, regex1: boolean | undefined, partial1: any, _params: Params): Promise<any>;
29
- _collectLocatorInformation(selectorHierarchy: any, index: number | undefined, scope: any, foundLocators: any, _params: Params, info: any, visibleOnly?: boolean): Promise<void>;
70
+ _locateElementByText(scope: any, text1: any, tag1: any, regex1: boolean | undefined, partial1: any, ignoreCase: boolean | undefined, _params: Params): Promise<{
71
+ elementCount: number;
72
+ randomToken: string;
73
+ }>;
74
+ _collectLocatorInformation(selectorHierarchy: any, index: number | undefined, scope: any, foundLocators: any, _params: Params, info: any, visibleOnly?: boolean, allowDisabled?: boolean | undefined, element_name?: null, logErrors?: boolean | undefined): Promise<void>;
30
75
  closeUnexpectedPopups(info: any, _params: any): Promise<{
31
76
  rerun: boolean;
32
77
  }>;
33
- _locate(selectors: any, info: any, _params?: Params, timeout?: number): Promise<any>;
34
- _locate_internal(selectors: any, info: any, _params?: Params, timeout?: number): Promise<any>;
35
- _scanLocatorsGroup(locatorsGroup: any, scope: any, _params: any, info: any, visibleOnly: any): Promise<{
78
+ _locate(selectors: any, info: any, _params?: Params, timeout: any, allowDisabled?: boolean | undefined): Promise<any>;
79
+ _findFrameScope(selectors: any, timeout: number | undefined, info: any): Promise<any>;
80
+ _getDocumentBody(selectors: any, timeout: number | undefined, info: any): Promise<any>;
81
+ _locate_internal(selectors: any, info: any, _params?: Params, timeout?: number, allowDisabled?: boolean | undefined): Promise<any>;
82
+ _scanLocatorsGroup(locatorsGroup: any, scope: any, _params: any, info: any, visibleOnly: any, allowDisabled?: boolean | undefined, element_name: any, logErrors?: boolean | undefined): Promise<{
36
83
  foundElements: any[];
37
84
  }>;
38
- click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
39
- setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<{}>;
40
- hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
41
- selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<{}>;
42
- type(_value: any, _params?: null, options?: {}, world?: null): Promise<{}>;
85
+ simpleClick(elementDescription: any, _params?: Params, options?: {}, world?: null): Promise<void>;
86
+ simpleClickType(elementDescription: any, value: any, _params?: Params, options?: {}, world?: null): Promise<void>;
87
+ click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
88
+ waitForElement(selectors: any, _params?: Params, options?: {}, world?: null): Promise<boolean>;
89
+ setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<any>;
90
+ hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
91
+ selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<any>;
92
+ type(_value: any, _params?: null, options?: {}, world?: null): Promise<any>;
43
93
  setInputValue(selectors: any, value: any, _params?: null, options?: {}, world?: null): Promise<void>;
44
94
  setDateTime(selectors: any, value: any, format?: null, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<void>;
45
- clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
46
- fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
95
+ clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
96
+ fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
97
+ setInputFiles(selectors: any, files: any, _params?: null, options?: {}, world?: null): Promise<any>;
47
98
  getText(selectors: any, _params?: null, options?: {}, info?: {}, world?: null): Promise<{
48
99
  text: any;
49
100
  screenshotId: any;
@@ -70,11 +121,12 @@ declare class StableBrowser {
70
121
  value: any;
71
122
  element?: undefined;
72
123
  }>;
73
- containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<{}>;
74
- containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<{}>;
75
- _getDataFile(world?: null): string;
124
+ containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<any>;
125
+ containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<any>;
126
+ snapshotValidation(frameSelectors: any, referanceSnapshot: any, _params?: null, options?: {}, world?: null): Promise<any>;
76
127
  waitForUserInput(message: any, world?: null): Promise<void>;
77
128
  setTestData(testData: any, world?: null): void;
129
+ overwriteTestData(testData: any, world?: null): void;
78
130
  _getDataFilePath(fileName: any): string;
79
131
  _parseCSVSync(filePath: any): Promise<unknown>;
80
132
  loadTestData(type: string, dataSelector: string, world?: null): {
@@ -86,47 +138,86 @@ declare class StableBrowser {
86
138
  getTestData(world?: null): {};
87
139
  _screenShot(options?: {}, world?: null, info?: null): Promise<{}>;
88
140
  takeScreenshot(screenshotPath: any): Promise<any>;
89
- verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<{}>;
90
- extractAttribute(selectors: any, attribute: any, variable: any, _params?: null, options?: {}, world?: null): Promise<{}>;
141
+ verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
142
+ extractAttribute(selectors: any, attribute: any, variable: any, _params?: null, options?: {}, world?: null): Promise<any>;
143
+ extractProperty(selectors: any, property: any, variable: any, _params?: null, options?: {}, world?: null): Promise<any>;
144
+ verifyAttribute(selectors: any, attribute: any, value: any, _params?: null, options?: {}, world?: null): Promise<any>;
145
+ verifyProperty(selectors: any, property: any, value: any, _params?: null, options?: {}, world?: null): Promise<any>;
91
146
  extractEmailData(emailAddress: any, options: any, world: any): Promise<{
92
147
  emailUrl: any;
93
148
  emailCode: any;
94
149
  }>;
95
150
  _highlightElements(scope: any, css: any): Promise<void>;
96
- verifyPagePath(pathPart: any, options?: {}, world?: null): Promise<{} | undefined>;
97
- verifyTextExistInPage(text: any, options?: {}, world?: null): Promise<{}>;
98
- _getServerUrl(): string;
99
- visualVerification(text: any, options?: {}, world?: null): Promise<{}>;
151
+ _matcher(text: any): {
152
+ matcher: any;
153
+ queryText: any;
154
+ };
155
+ _getDomain(url: string): string;
156
+ /**
157
+ * Verify the page path matches the given path.
158
+ * @param {string} pathPart - The path to verify.
159
+ * @param {object} options - Options for verification.
160
+ * @param {object} world - The world context.
161
+ * @returns {Promise<object>} - The state info after verification.
162
+ */
163
+ verifyPagePath(pathPart: string, options?: object, world?: object): Promise<object>;
164
+ /**
165
+ * Verify the page title matches the given title.
166
+ * @param {string} title - The title to verify.
167
+ * @param {object} options - Options for verification.
168
+ * @param {object} world - The world context.
169
+ * @returns {Promise<object>} - The state info after verification.
170
+ */
171
+ verifyPageTitle(title: string, options?: object, world?: object): Promise<object>;
172
+ findTextInAllFrames(dateAlternatives: any, numberAlternatives: any, text: any, state: any, partial?: boolean, ignoreCase?: boolean): Promise<{
173
+ elementCount: number;
174
+ randomToken: string;
175
+ }[]>;
176
+ verifyTextExistInPage(text: any, options?: {}, world?: null): Promise<any>;
177
+ waitForTextToDisappear(text: any, options?: {}, world?: null): Promise<any>;
178
+ verifyTextRelatedToText(textAnchor: string, climb: number, textToVerify: string, options?: {}, world?: any): Promise<any>;
179
+ findRelatedTextInAllFrames(textAnchor: string, climb: number, textToVerify: string, params?: Params, options?: {}, world?: any): Promise<{
180
+ elementCount: number;
181
+ randomToken: string;
182
+ }[]>;
183
+ visualVerification(text: any, options?: {}, world?: null): Promise<{} | undefined>;
100
184
  verifyTableData(selectors: any, data: any, _params?: null, options?: {}, world?: null): Promise<void>;
101
185
  getTableData(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
102
- analyzeTable(selectors: any, query: any, operator: any, value: any, _params?: null, options?: {}, world?: null): Promise<{}>;
103
- _replaceWithLocalData(value: any, world: any, _decrypt?: boolean, totpWait?: boolean): Promise<any>;
186
+ analyzeTable(selectors: any, query: any, operator: any, value: any, _params?: null, options?: {}, world?: null): Promise<{} | undefined>;
187
+ /**
188
+ * Explicit wait/sleep function that pauses execution for a specified duration
189
+ * @param duration - Duration to sleep in milliseconds (default: 1000ms)
190
+ * @param options - Optional configuration object
191
+ * @param world - Optional world context
192
+ * @returns Promise that resolves after the specified duration
193
+ */
194
+ sleep(duration?: number, options?: {}, world?: null): Promise<any>;
195
+ _replaceWithLocalData(value: any, world: any, _decrypt?: boolean, totpWait?: boolean): Promise<string>;
104
196
  _getLoadTimeout(options: any): number;
197
+ _getFindElementTimeout(options: any): any;
198
+ saveStoreState(path?: string | null, world?: any): Promise<void>;
199
+ restoreSaveState(path?: string | null, world?: any): Promise<void>;
105
200
  waitForPageLoad(options?: {}, world?: null): Promise<void>;
106
201
  closePage(options?: {}, world?: null): Promise<void>;
202
+ tableCellOperation(headerText: string, rowText: string, options: any, _params: Params, world?: null): Promise<void>;
203
+ saveTestDataAsGlobal(options: any, world: any): void;
107
204
  setViewportSize(width: number, hight: number, options?: {}, world?: null): Promise<void>;
108
205
  reloadPage(options?: {}, world?: null): Promise<void>;
109
206
  scrollIfNeeded(element: any, info: any): Promise<void>;
110
- _reportToWorld(world: any, properties: JsonCommandReport): void;
207
+ beforeScenario(world: any, scenario: any): Promise<void>;
208
+ afterScenario(world: any, scenario: any): Promise<void>;
209
+ beforeStep(world: any, step: any): Promise<void>;
210
+ getAriaSnapshot(): Promise<string | null>;
211
+ /**
212
+ * Sends command with custom payload to report.
213
+ * @param commandText - Title of the command to be shown in the report.
214
+ * @param commandStatus - Status of the command (e.g. "PASSED", "FAILED").
215
+ * @param content - Content of the command to be shown in the report.
216
+ * @param options - Options for the command. Example: { type: "json", screenshot: true }
217
+ * @param world - Optional world context.
218
+ * @public
219
+ */
220
+ addCommandToReport(commandText: string, commandStatus: "PASSED" | "FAILED", content: string, options?: any, world?: any): Promise<void>;
221
+ afterStep(world: any, step: any): Promise<void>;
111
222
  }
112
- type JsonTimestamp = number;
113
- type JsonResultPassed = {
114
- status: "PASSED";
115
- startTime: JsonTimestamp;
116
- endTime: JsonTimestamp;
117
- };
118
- type JsonResultFailed = {
119
- status: "FAILED";
120
- startTime: JsonTimestamp;
121
- endTime: JsonTimestamp;
122
- message?: string;
123
- };
124
- type JsonCommandResult = JsonResultPassed | JsonResultFailed;
125
- type JsonCommandReport = {
126
- type: string;
127
- value?: string;
128
- text: string;
129
- screenshotId?: string;
130
- result: JsonCommandResult;
131
- };
132
223
  export { StableBrowser };