automation_model 1.0.445-dev → 1.0.445

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 +4 -0
  21. package/lib/environment.js +6 -2
  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 +5 -2
  37. package/lib/init_browser.js +128 -11
  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 +152 -56
  56. package/lib/stable_browser.js +2416 -1303
  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 +18 -10
@@ -1,44 +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
+ };
45
+ export declare const apps: {};
3
46
  declare class StableBrowser {
4
47
  browser: Browser;
5
48
  page: Page;
6
49
  logger: any;
7
50
  context: any;
51
+ world?: any;
52
+ fastMode: boolean;
8
53
  project_path: null;
9
54
  webLogFile: null;
55
+ networkLogger: null;
10
56
  configuration: null;
11
- constructor(browser: Browser, page: Page, logger?: any, context?: any);
12
- getWebLogFile(logFolder: string): string;
13
- registerConsoleLogListener(page: Page, context: any, logFile: string): void;
14
- registerRequestListener(): void;
15
- goto(url: string): Promise<void>;
16
- _validateSelectors(selectors: any): void;
17
- _fixUsingParams(text: any, _params: Params): any;
18
- _fixLocatorUsingParams(locator: any, _params: Params): any;
19
- _isObject(value: any): any;
20
- scanAndManipulate(currentObj: any, _params: Params): void;
21
- _getLocator(locator: any, scope: any, _params: any): any;
57
+ appName: string;
58
+ tags: null;
59
+ isRecording: boolean;
60
+ initSnapshotTaken: boolean;
61
+ constructor(browser: Browser, page: Page, logger?: any, context?: any, world?: any, fastMode?: boolean);
62
+ registerEventListeners(context: any): void;
63
+ switchApp(appName: any): Promise<void>;
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>;
22
69
  _locateElmentByTextClimbCss(scope: any, text: any, climb: any, css: any, _params: Params): Promise<string | undefined>;
23
- _locateElementByText(scope: any, text1: any, tag1: any, regex1: boolean | undefined, partial1: any, _params: Params): Promise<any>;
24
- _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>;
25
75
  closeUnexpectedPopups(info: any, _params: any): Promise<{
26
76
  rerun: boolean;
27
77
  }>;
28
- _locate(selectors: any, info: any, _params?: Params, timeout?: number): Promise<any>;
29
- _locate_internal(selectors: any, info: any, _params?: Params, timeout?: number): Promise<any>;
30
- _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<{
31
83
  foundElements: any[];
32
84
  }>;
33
- click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
34
- setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<{}>;
35
- hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
36
- selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<{}>;
37
- 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>;
38
93
  setInputValue(selectors: any, value: any, _params?: null, options?: {}, world?: null): Promise<void>;
39
94
  setDateTime(selectors: any, value: any, format?: null, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<void>;
40
- clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
41
- 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>;
42
98
  getText(selectors: any, _params?: null, options?: {}, info?: {}, world?: null): Promise<{
43
99
  text: any;
44
100
  screenshotId: any;
@@ -65,11 +121,12 @@ declare class StableBrowser {
65
121
  value: any;
66
122
  element?: undefined;
67
123
  }>;
68
- containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<{}>;
69
- containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<{}>;
70
- _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>;
71
127
  waitForUserInput(message: any, world?: null): Promise<void>;
72
128
  setTestData(testData: any, world?: null): void;
129
+ overwriteTestData(testData: any, world?: null): void;
73
130
  _getDataFilePath(fileName: any): string;
74
131
  _parseCSVSync(filePath: any): Promise<unknown>;
75
132
  loadTestData(type: string, dataSelector: string, world?: null): {
@@ -81,47 +138,86 @@ declare class StableBrowser {
81
138
  getTestData(world?: null): {};
82
139
  _screenShot(options?: {}, world?: null, info?: null): Promise<{}>;
83
140
  takeScreenshot(screenshotPath: any): Promise<any>;
84
- verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<{}>;
85
- 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>;
86
146
  extractEmailData(emailAddress: any, options: any, world: any): Promise<{
87
147
  emailUrl: any;
88
148
  emailCode: any;
89
149
  }>;
90
150
  _highlightElements(scope: any, css: any): Promise<void>;
91
- verifyPagePath(pathPart: any, options?: {}, world?: null): Promise<{} | undefined>;
92
- verifyTextExistInPage(text: any, options?: {}, world?: null): Promise<{}>;
93
- _getServerUrl(): string;
94
- 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>;
95
184
  verifyTableData(selectors: any, data: any, _params?: null, options?: {}, world?: null): Promise<void>;
96
185
  getTableData(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
97
- analyzeTable(selectors: any, query: any, operator: any, value: any, _params?: null, options?: {}, world?: null): Promise<{}>;
98
- _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>;
99
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>;
100
200
  waitForPageLoad(options?: {}, world?: null): Promise<void>;
101
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;
102
204
  setViewportSize(width: number, hight: number, options?: {}, world?: null): Promise<void>;
103
205
  reloadPage(options?: {}, world?: null): Promise<void>;
104
206
  scrollIfNeeded(element: any, info: any): Promise<void>;
105
- _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>;
106
222
  }
107
- type JsonTimestamp = number;
108
- type JsonResultPassed = {
109
- status: "PASSED";
110
- startTime: JsonTimestamp;
111
- endTime: JsonTimestamp;
112
- };
113
- type JsonResultFailed = {
114
- status: "FAILED";
115
- startTime: JsonTimestamp;
116
- endTime: JsonTimestamp;
117
- message?: string;
118
- };
119
- type JsonCommandResult = JsonResultPassed | JsonResultFailed;
120
- type JsonCommandReport = {
121
- type: string;
122
- value?: string;
123
- text: string;
124
- screenshotId?: string;
125
- result: JsonCommandResult;
126
- };
127
223
  export { StableBrowser };