automation_model 1.0.449-dev → 1.0.449

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