lexxit-automation-framework 3.0.3 → 3.0.4

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 (54) hide show
  1. package/dist-obf/actions/baseHandler.js +1 -1
  2. package/dist-obf/actions/browserManager.js +1 -1
  3. package/dist-obf/actions/checkboxHandler.js +1 -1
  4. package/dist-obf/actions/clickHandler.js +1 -1
  5. package/dist-obf/actions/customcodehandler.js +1 -1
  6. package/dist-obf/actions/dropdownHandler.js +1 -1
  7. package/dist-obf/actions/radiobuttonHandler.js +1 -1
  8. package/dist-obf/actions/textHandler.js +1 -1
  9. package/dist-obf/api/server.js +1 -1
  10. package/dist-obf/config.js +1 -1
  11. package/dist-obf/executor/functionMap.js +1 -1
  12. package/dist-obf/executor/mapping.js +1 -1
  13. package/dist-obf/executor/scriptExecutor.js +1 -1
  14. package/dist-obf/executor/stepExecutor.js +1 -1
  15. package/dist-obf/runner/testRunner.js +1 -1
  16. package/dist-obf/sse/sseManager.js +1 -1
  17. package/dist-obf/store/executionStore.js +1 -1
  18. package/dist-obf/store/testDataStore.js +1 -1
  19. package/dist-obf/types/types.js +1 -1
  20. package/dist-obf/utils/healingService.js +1 -1
  21. package/dist-obf/utils/locatorService.js +1 -1
  22. package/dist-obf/utils/logger.js +1 -1
  23. package/dist-obf/utils/metadataService.js +1 -1
  24. package/dist-obf/utils/waitConditions.js +1 -1
  25. package/dist-obf/validator/validator.js +1 -1
  26. package/package.json +5 -2
  27. package/npmignore +0 -8
  28. package/public/dashboard.html +0 -591
  29. package/src/actions/baseHandler.ts +0 -351
  30. package/src/actions/browserManager.ts +0 -432
  31. package/src/actions/checkboxHandler.ts +0 -276
  32. package/src/actions/clickHandler.ts +0 -513
  33. package/src/actions/customcodehandler.ts +0 -251
  34. package/src/actions/dropdownHandler.ts +0 -501
  35. package/src/actions/radiobuttonHandler.ts +0 -286
  36. package/src/actions/textHandler.ts +0 -498
  37. package/src/api/server.ts +0 -210
  38. package/src/config.ts +0 -7
  39. package/src/executor/functionMap.ts +0 -153
  40. package/src/executor/mapping.ts +0 -70
  41. package/src/executor/scriptExecutor.ts +0 -162
  42. package/src/executor/stepExecutor.ts +0 -289
  43. package/src/runner/testRunner.ts +0 -78
  44. package/src/sse/sseManager.ts +0 -130
  45. package/src/store/executionStore.ts +0 -152
  46. package/src/store/testDataStore.ts +0 -46
  47. package/src/types/types.ts +0 -159
  48. package/src/utils/healingService.ts +0 -210
  49. package/src/utils/locatorService.ts +0 -73
  50. package/src/utils/logger.ts +0 -27
  51. package/src/utils/metadataService.ts +0 -137
  52. package/src/utils/waitConditions.ts +0 -141
  53. package/src/validator/validator.ts +0 -140
  54. package/tsconfig.json +0 -16
@@ -1,351 +0,0 @@
1
- // // import { StepResult } from '../types/types';
2
-
3
- // // export abstract class BaseHandler {
4
-
5
- // // protected getStartTime(): string {
6
- // // return new Date().toISOString();
7
- // // }
8
-
9
- // // protected getDuration(startMs: number): number {
10
- // // return Date.now() - startMs;
11
- // // }
12
-
13
- // // protected buildResult(
14
- // // status: 'PASS' | 'FAIL',
15
- // // expected_result: string,
16
- // // comments: string,
17
- // // startMs: number,
18
- // // startTime: string,
19
- // // step_name: string = '',
20
- // // step_script: string = '',
21
- // // uid: string | null = null,
22
- // // obj_uid: string | null = null,
23
- // // page_uid: string | null = null
24
- // // ): StepResult {
25
- // // return {
26
- // // uid,
27
- // // obj_uid,
28
- // // page_uid,
29
- // // step_name,
30
- // // step_script,
31
- // // status,
32
- // // expected_result,
33
- // // comments,
34
- // // duration: this.getDuration(startMs),
35
- // // start_time: startTime,
36
- // // screenshot: ''
37
- // // };
38
- // // }
39
-
40
- // // protected classifyError(error: any): string {
41
- // // const msg: string = error?.message || String(error);
42
-
43
- // // if (msg.includes('Element not found') || msg.includes('not visible')) {
44
- // // return `Element not found or not visible: ${msg}`;
45
- // // }
46
- // // if (msg.includes('Timeout') || msg.includes('timeout')) {
47
- // // return `Timeout error - element took too long to respond: ${msg}`;
48
- // // }
49
- // // if (msg.includes('not editable') || msg.includes('not enabled')) {
50
- // // return `Element is not editable or disabled: ${msg}`;
51
- // // }
52
- // // if (msg.includes('detached')) {
53
- // // return `Element got detached from DOM: ${msg}`;
54
- // // }
55
- // // if (msg.includes('Target closed') || msg.includes('has been closed')) {
56
- // // return `Browser or page closed unexpectedly: ${msg}`;
57
- // // }
58
- // // if (msg.includes('intercepts pointer events') || msg.includes('not visible within')) {
59
- // // return `Element is covered by another element: ${msg}`;
60
- // // }
61
- // // if (msg.includes('not enabled')) {
62
- // // return `Element is disabled: ${msg}`;
63
- // // }
64
- // // if (msg.includes('Navigation') && msg.includes('timeout')) {
65
- // // return `Navigation after click timed out: ${msg}`;
66
- // // }
67
-
68
- // // return `Unexpected error: ${msg}`;
69
- // // }
70
-
71
- // // protected appendMatchedLocatorInfo(comments: string, matchedIndex: number, matchedXPath: string): string {
72
- // // if (matchedIndex > 0) {
73
- // // return `${comments} (Matched locator at position ${matchedIndex}: ${matchedXPath})`;
74
- // // }
75
- // // return comments;
76
- // // }
77
- // // }
78
-
79
- // import { Page } from 'playwright';
80
- // import { StepResult, ScreenshotMode } from '../types/types';
81
-
82
- // export abstract class BaseHandler {
83
-
84
- // // ─── Network Response Capture ─────────────────────────────────────────────
85
-
86
- // protected lastApiResponse: { status: number; url: string; body: any } | null = null;
87
-
88
- // /**
89
- // * Call once in the subclass constructor for handlers that want
90
- // * network-response diagnostics on locator failures.
91
- // */
92
- // protected setupNetworkCapture(page: Page): void {
93
- // try {
94
- // page.on('response', async (resp) => {
95
- // try {
96
- // const ct = resp.headers()['content-type'] || '';
97
- // if (
98
- // ct.includes('application/json') ||
99
- // ct.includes('text/plain') ||
100
- // ct.includes('application/text')
101
- // ) {
102
- // let body: any;
103
- // try { body = await resp.json(); }
104
- // catch { try { body = await resp.text(); } catch { body = undefined; } }
105
- // this.lastApiResponse = { status: resp.status(), url: resp.url(), body };
106
- // }
107
- // } catch { /* swallow */ }
108
- // });
109
- // } catch { /* ignore if page event binding fails */ }
110
- // }
111
-
112
- // protected getLastApiResponse() {
113
- // return this.lastApiResponse;
114
- // }
115
-
116
- // // ─── Screenshot / Page-source capture ────────────────────────────────────
117
-
118
- // protected async captureScreenshot(
119
- // page: Page,
120
- // mode: ScreenshotMode,
121
- // isFailure: boolean
122
- // ): Promise<string | undefined> {
123
- // if (mode === 'never') return undefined;
124
- // if (mode === 'on_failure' && !isFailure) return undefined;
125
- // try {
126
- // if (!page || page.isClosed()) return undefined;
127
- // const buf = await page.screenshot({ type: 'png', fullPage: false });
128
- // return buf.toString('base64');
129
- // } catch {
130
- // return undefined;
131
- // }
132
- // }
133
-
134
- // protected async capturePageSource(page: Page): Promise<string | undefined> {
135
- // try {
136
- // if (!page || page.isClosed()) return undefined;
137
- // return await page.content();
138
- // } catch {
139
- // return undefined;
140
- // }
141
- // }
142
-
143
- // protected async captureFailureMetadata(
144
- // page: Page,
145
- // mode: ScreenshotMode
146
- // ): Promise<{ screenshot?: string; pageSource?: string }> {
147
- // const screenshot = await this.captureScreenshot(page, mode, true);
148
- // const pageSource = await this.capturePageSource(page);
149
- // return { screenshot, pageSource };
150
- // }
151
-
152
- // // ─── Timing helpers ───────────────────────────────────────────────────────
153
-
154
- // protected getStartTime(): string {
155
- // return new Date().toISOString();
156
- // }
157
-
158
- // protected getDuration(startMs: number): number {
159
- // return Date.now() - startMs;
160
- // }
161
-
162
- // // ─── Result builder ───────────────────────────────────────────────────────
163
-
164
- // protected buildResult(
165
- // status: 'PASS' | 'FAIL',
166
- // expected_result: string,
167
- // comments: string,
168
- // startMs: number,
169
- // startTime: string,
170
- // step_name: string = '',
171
- // step_script: string = '',
172
- // uid: string | null = null,
173
- // obj_uid: string | null = null,
174
- // page_uid: string | null = null
175
- // ): StepResult {
176
- // return {
177
- // uid,
178
- // obj_uid,
179
- // page_uid,
180
- // step_name,
181
- // step_script,
182
- // status,
183
- // expected_result,
184
- // comments,
185
- // duration: this.getDuration(startMs),
186
- // start_time: startTime,
187
- // screenshot: ''
188
- // };
189
- // }
190
-
191
- // // ─── Error classification ─────────────────────────────────────────────────
192
-
193
- // protected classifyError(error: any): string {
194
- // const msg: string = error?.message || String(error);
195
-
196
- // if (msg.includes('Element not found') || msg.includes('not visible')) {
197
- // return `Element not found or not visible: ${msg}`;
198
- // }
199
- // if (msg.includes('Timeout') || msg.includes('timeout')) {
200
- // return `Timeout error - element took too long to respond: ${msg}`;
201
- // }
202
- // if (msg.includes('not editable') || msg.includes('not enabled')) {
203
- // return `Element is not editable or disabled: ${msg}`;
204
- // }
205
- // if (msg.includes('detached')) {
206
- // return `Element got detached from DOM: ${msg}`;
207
- // }
208
- // if (msg.includes('Target closed') || msg.includes('has been closed')) {
209
- // return `Browser or page closed unexpectedly: ${msg}`;
210
- // }
211
- // if (msg.includes('intercepts pointer events') || msg.includes('not visible within')) {
212
- // return `Element is covered by another element: ${msg}`;
213
- // }
214
- // if (msg.includes('not enabled')) {
215
- // return `Element is disabled: ${msg}`;
216
- // }
217
- // if (msg.includes('Navigation') && msg.includes('timeout')) {
218
- // return `Navigation after click timed out: ${msg}`;
219
- // }
220
-
221
- // return `Unexpected error: ${msg}`;
222
- // }
223
-
224
- // protected appendMatchedLocatorInfo(comments: string, matchedIndex: number, matchedXPath: string): string {
225
- // if (matchedIndex > 0) {
226
- // return `${comments} (Matched locator at position ${matchedIndex}: ${matchedXPath})`;
227
- // }
228
- // return comments;
229
- // }
230
- // }
231
- import { Page } from 'playwright';
232
- import { StepResult, ScreenshotMode } from '../types/types';
233
- import { DEFAULT_SCREENSHOT_MODE } from '../config';
234
-
235
- export abstract class BaseHandler {
236
-
237
- protected page!: Page;
238
- protected screenshotMode: ScreenshotMode = DEFAULT_SCREENSHOT_MODE;
239
-
240
- // ─── Network Response Capture ─────────────────────────────────────────────
241
-
242
- protected lastApiResponse: { status: number; url: string; body: any } | null = null;
243
-
244
- protected setupNetworkCapture(page: Page): void {
245
- try {
246
- page.on('response', async (resp) => {
247
- try {
248
- const ct = resp.headers()['content-type'] || '';
249
- if (
250
- ct.includes('application/json') ||
251
- ct.includes('text/plain') ||
252
- ct.includes('application/text')
253
- ) {
254
- let body: any;
255
- try { body = await resp.json(); }
256
- catch { try { body = await resp.text(); } catch { body = undefined; } }
257
- this.lastApiResponse = { status: resp.status(), url: resp.url(), body };
258
- }
259
- } catch {}
260
- });
261
- } catch {}
262
- }
263
-
264
- protected getLastApiResponse() {
265
- return this.lastApiResponse;
266
- }
267
-
268
- // ─── Screenshot ───────────────────────────────────────────────────────────
269
-
270
- protected async captureScreenshot(isFailure: boolean): Promise<string | undefined> {
271
- if (this.screenshotMode === 'never') return undefined;
272
- if (this.screenshotMode === 'on_failure' && !isFailure) return undefined;
273
- try {
274
- if (!this.page || this.page.isClosed()) return undefined;
275
- const buf = await this.page.screenshot({ type: 'png', fullPage: false });
276
- return buf.toString('base64');
277
- } catch {
278
- return undefined;
279
- }
280
- }
281
-
282
- protected async capturePageSource(): Promise<string | undefined> {
283
- try {
284
- if (!this.page || this.page.isClosed()) return undefined;
285
- return await this.page.content();
286
- } catch {
287
- return undefined;
288
- }
289
- }
290
-
291
- // ─── Timing ───────────────────────────────────────────────────────────────
292
-
293
- protected getStartTime(): string {
294
- return new Date().toISOString().replace('T', ' ').split('.')[0];
295
- }
296
-
297
- // protected getDuration(startMs: number): string {
298
- // const diff = Math.round((Date.now() - startMs) / 1000);
299
- // return `${diff} second${diff !== 1 ? 's' : ''}`;
300
- // }
301
- protected getDuration(startMs: number): number {
302
- return Date.now() - startMs;
303
- }
304
-
305
- // ─── Result Builder ───────────────────────────────────────────────────────
306
-
307
- protected buildResult(
308
- status: 'PASS' | 'FAIL',
309
- expected_result: string,
310
- comments: string,
311
- startMs: number,
312
- startTime: string,
313
- step_name: string = '',
314
- screenshot?: string
315
- ): StepResult {
316
- return {
317
- uid: null,
318
- obj_uid: null,
319
- page_uid: null,
320
- step_name,
321
- step_script: '',
322
- status,
323
- expected_result,
324
- comments,
325
- duration: this.getDuration(startMs),
326
- start_time: startTime,
327
- ...(screenshot !== undefined ? { screenshot } : {})
328
- };
329
- }
330
-
331
- // ─── Error Classification ─────────────────────────────────────────────────
332
-
333
- protected classifyError(error: any): string {
334
- const msg: string = error?.message || String(error);
335
- if (msg.includes('Element not found') || msg.includes('not visible')) return `Element not found or not visible: ${msg}`;
336
- if (msg.includes('Timeout') || msg.includes('timeout')) return `Timeout error - element took too long to respond: ${msg}`;
337
- if (msg.includes('not editable') || msg.includes('not enabled')) return `Element is not editable or disabled: ${msg}`;
338
- if (msg.includes('detached')) return `Element got detached from DOM: ${msg}`;
339
- if (msg.includes('Target closed') || msg.includes('has been closed')) return `Browser or page closed unexpectedly: ${msg}`;
340
- if (msg.includes('intercepts pointer events') || msg.includes('not visible within')) return `Element is covered by another element: ${msg}`;
341
- if (msg.includes('Navigation') && msg.includes('timeout')) return `Navigation after click timed out: ${msg}`;
342
- return `Unexpected error: ${msg}`;
343
- }
344
-
345
- protected appendMatchedLocatorInfo(comments: string, matchedIndex: number, matchedXPath: string): string {
346
- if (matchedIndex > 0) {
347
- return `${comments} (Matched locator at position ${matchedIndex}: ${matchedXPath})`;
348
- }
349
- return comments;
350
- }
351
- }