ff-automationv2 2.2.35 → 2.2.36-beta.2

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 (68) hide show
  1. package/dist/ai/llmcalls/llmAction.js +6 -5
  2. package/dist/ai/llmprompts/llmPromptTypes/systemPromptTypes.d.ts +3 -0
  3. package/dist/ai/llmprompts/promptRegistry.js +4 -0
  4. package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +133 -133
  5. package/dist/ai/llmprompts/systemPrompts/arithmeticPrompt.js +40 -40
  6. package/dist/ai/llmprompts/systemPrompts/fileVerifyActionExtractorPrompt.js +36 -36
  7. package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +4 -4
  8. package/dist/ai/llmprompts/systemPrompts/getActionExtractorPrompt.js +51 -51
  9. package/dist/ai/llmprompts/systemPrompts/inputContextPrompt.js +49 -49
  10. package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +86 -86
  11. package/dist/ai/llmprompts/systemPrompts/multichannelKeywordExtractor.js +47 -47
  12. package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +16 -16
  13. package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.d.ts +2 -0
  14. package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.js +54 -0
  15. package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.js +43 -43
  16. package/dist/ai/llmprompts/userPrompts/userPrompt.js +21 -0
  17. package/dist/automation/actions/executor.d.ts +1 -0
  18. package/dist/automation/actions/executor.js +23 -0
  19. package/dist/automation/actions/interaction/swipe/slider_Swipe.d.ts +2 -0
  20. package/dist/automation/actions/interaction/swipe/slider_Swipe.js +129 -0
  21. package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +6 -0
  22. package/dist/automation/actions/interface/FireFlinkResponseSchema.js +8 -1
  23. package/dist/automation/actions/interface/swipeActionInterface.d.ts +15 -0
  24. package/dist/core/helpers/mobileSwipeHelper.d.ts +3 -0
  25. package/dist/core/helpers/mobileSwipeHelper.js +78 -0
  26. package/dist/core/helpers/visionFallbackHandler.js +5 -3
  27. package/dist/core/interfaces/actionInterface.d.ts +1 -0
  28. package/dist/core/interfaces/mobileSwipeSliderInterface.d.ts +25 -0
  29. package/dist/core/interfaces/mobileSwipeSliderInterface.js +2 -0
  30. package/dist/core/interfaces/promptInterface.d.ts +4 -0
  31. package/dist/core/main/actionHandlerFactory.js +2 -2
  32. package/dist/core/main/runAutomationScript.js +44 -1
  33. package/dist/core/types/promptType.d.ts +1 -0
  34. package/dist/core/types/promptType.js +1 -0
  35. package/dist/domAnalysis/searchBest.js +0 -1
  36. package/dist/utils/DomExtraction/jsForAttributeInjection.js +232 -232
  37. package/dist/utils/helpers/xpathcreation.js +18 -2
  38. package/package.json +91 -91
  39. package/dist/tests/Framework.d.ts +0 -0
  40. package/dist/tests/Framework.js +0 -62
  41. package/dist/tests/itertaion.d.ts +0 -1
  42. package/dist/tests/itertaion.js +0 -43
  43. package/dist/tests/multiBrowser.d.ts +0 -1
  44. package/dist/tests/multiBrowser.js +0 -34
  45. package/dist/tests/poc.d.ts +0 -0
  46. package/dist/tests/poc.js +0 -212
  47. package/dist/tests/senario.d.ts +0 -0
  48. package/dist/tests/senario.js +0 -1120
  49. package/dist/tests/start_iteration_suggestion.d.ts +0 -6
  50. package/dist/tests/start_iteration_suggestion.js +0 -46
  51. package/dist/tests/test.d.ts +0 -1
  52. package/dist/tests/test.js +0 -26
  53. package/dist/tests/test1.d.ts +0 -1
  54. package/dist/tests/test1.js +0 -30
  55. package/dist/tests/test12.d.ts +0 -1
  56. package/dist/tests/test12.js +0 -35
  57. package/dist/tests/test254.d.ts +0 -0
  58. package/dist/tests/test254.js +0 -87
  59. package/dist/tests/test3.d.ts +0 -1
  60. package/dist/tests/test3.js +0 -27
  61. package/dist/tests/testkaf.d.ts +0 -0
  62. package/dist/tests/testkaf.js +0 -52
  63. package/dist/tests/tests.data.d.ts +0 -1
  64. package/dist/tests/tests.data.js +0 -8
  65. package/dist/tests/testss.d.ts +0 -1
  66. package/dist/tests/testss.js +0 -23
  67. package/dist/tests/testwe.d.ts +0 -1
  68. package/dist/tests/testwe.js +0 -24
package/package.json CHANGED
@@ -1,91 +1,91 @@
1
- {
2
- "name": "ff-automationv2",
3
- "version": "2.2.35",
4
- "private": false,
5
- "type": "commonjs",
6
- "description": "This lib is used to automate the manual testcase",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
14
- }
15
- },
16
- "files": [
17
- "dist"
18
- ],
19
- "scripts": {
20
- "type-check": "tsc --noEmit",
21
- "builds": "npm run lint && tsc",
22
- "build": "eslint . && tsc && echo Build Successful",
23
- "prepare": "husky",
24
- "lint": "eslint src --max-warnings=0",
25
- "test": "npm run build && node dist/tests/test.js",
26
- "llm": "npm run build && node dist/tests/testllm.js",
27
- "dev": "npm run build && node dist/index.js",
28
- "start": "node dist/index.js",
29
- "file": "node dist/domAnalysis/getXpath.js",
30
- "error": "node dist/tests/test12.js",
31
- "bro": "node dist/tests/test3.js"
32
- },
33
- "keywords": [],
34
- "author": "Diwahar R",
35
- "license": "ISC",
36
- "devDependencies": {
37
- "@eslint/js": "10.0.1",
38
- "@types/adm-zip": "^0.5.8",
39
- "@types/express": "^5.0.6",
40
- "@types/fs-extra": "^11.0.4",
41
- "@types/js-beautify": "^1.14.3",
42
- "@types/jsdom": "27.0.0",
43
- "@types/node": "^25.9.1",
44
- "@types/plist": "^3.0.5",
45
- "chromedriver": "^146.0.3",
46
- "edgedriver": "^6.3.0",
47
- "eslint": "10.0.0",
48
- "fastest-levenshtein": "^1.0.16",
49
- "geckodriver": "^6.1.0",
50
- "globals": "17.3.0",
51
- "husky": "^9.1.7",
52
- "jiti": "2.6.1",
53
- "nodemon": "3.1.11",
54
- "tls": "^0.0.1",
55
- "ts-node": "10.9.2",
56
- "tsx": "^4.21.0",
57
- "typescript": "^5.9.3",
58
- "typescript-eslint": "8.56.0",
59
- "webdriverio": "9.26.1"
60
- },
61
- "dependencies": {
62
- "@ai-sdk/anthropic": "^3.0.86",
63
- "@ai-sdk/azure": "^3.0.77",
64
- "@ai-sdk/google": "^3.0.83",
65
- "@ai-sdk/google-vertex": "^4.0.149",
66
- "@ai-sdk/groq": "^3.0.42",
67
- "@ai-sdk/openai": "^3.0.74",
68
- "@napi-rs/canvas": "^0.1.100",
69
- "@toon-format/toon": "^2.3.0",
70
- "@xmldom/xmldom": "^0.8.11",
71
- "adm-zip": "^0.5.17",
72
- "ai": "^6.0.209",
73
- "axios": "^1.13.5",
74
- "cheerio": "1.2.0",
75
- "express": "^5.2.1",
76
- "fast-fuzzy": "^1.12.0",
77
- "fastest-levenshtein": "^1.0.16",
78
- "google-auth": "^0.0.1",
79
- "google-auth-library": "^10.6.2",
80
- "js-beautify": "1.15.1",
81
- "jsdom": "27.4.0",
82
- "jsonrepair": "^3.14.1",
83
- "kafkajs": "^2.2.4",
84
- "openai": "6.18.0",
85
- "pdfjs-dist": "^6.3.289",
86
- "plist": "^3.1.0",
87
- "uuid": "13.0.0",
88
- "webdriverio": "9.26.1",
89
- "xpath": "^0.0.34"
90
- }
91
- }
1
+ {
2
+ "name": "ff-automationv2",
3
+ "version": "2.2.36-beta.2",
4
+ "private": false,
5
+ "type": "commonjs",
6
+ "description": "This lib is used to automate the manual testcase",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "type-check": "tsc --noEmit",
21
+ "builds": "npm run lint && tsc",
22
+ "build": "eslint . && tsc && echo Build Successful",
23
+ "prepare": "husky",
24
+ "lint": "eslint src --max-warnings=0",
25
+ "test": "npm run build && node dist/tests/test.js",
26
+ "llm": "npm run build && node dist/tests/testllm.js",
27
+ "dev": "npm run build && node dist/index.js",
28
+ "start": "node dist/index.js",
29
+ "file": "node dist/domAnalysis/getXpath.js",
30
+ "error": "node dist/tests/test12.js",
31
+ "bro": "node dist/tests/test3.js"
32
+ },
33
+ "keywords": [],
34
+ "author": "Diwahar R",
35
+ "license": "ISC",
36
+ "devDependencies": {
37
+ "@eslint/js": "10.0.1",
38
+ "@types/adm-zip": "^0.5.8",
39
+ "@types/express": "^5.0.6",
40
+ "@types/fs-extra": "^11.0.4",
41
+ "@types/js-beautify": "^1.14.3",
42
+ "@types/jsdom": "27.0.0",
43
+ "@types/node": "^25.9.1",
44
+ "@types/plist": "^3.0.5",
45
+ "chromedriver": "^146.0.3",
46
+ "edgedriver": "^6.3.0",
47
+ "eslint": "10.0.0",
48
+ "fastest-levenshtein": "^1.0.16",
49
+ "geckodriver": "^6.1.0",
50
+ "globals": "17.3.0",
51
+ "husky": "^9.1.7",
52
+ "jiti": "2.6.1",
53
+ "nodemon": "3.1.11",
54
+ "tls": "^0.0.1",
55
+ "ts-node": "10.9.2",
56
+ "tsx": "^4.21.0",
57
+ "typescript": "^5.9.3",
58
+ "typescript-eslint": "8.56.0",
59
+ "webdriverio": "9.26.1"
60
+ },
61
+ "dependencies": {
62
+ "@ai-sdk/anthropic": "^3.0.86",
63
+ "@ai-sdk/azure": "^3.0.77",
64
+ "@ai-sdk/google": "^3.0.83",
65
+ "@ai-sdk/google-vertex": "^4.0.149",
66
+ "@ai-sdk/groq": "^3.0.42",
67
+ "@ai-sdk/openai": "^3.0.74",
68
+ "@napi-rs/canvas": "^0.1.100",
69
+ "@toon-format/toon": "^2.3.0",
70
+ "@xmldom/xmldom": "^0.8.11",
71
+ "adm-zip": "^0.5.17",
72
+ "ai": "^6.0.209",
73
+ "axios": "^1.13.5",
74
+ "cheerio": "1.2.0",
75
+ "express": "^5.2.1",
76
+ "fast-fuzzy": "^1.12.0",
77
+ "fastest-levenshtein": "^1.0.16",
78
+ "google-auth": "^0.0.1",
79
+ "google-auth-library": "^10.6.2",
80
+ "js-beautify": "1.15.1",
81
+ "jsdom": "27.4.0",
82
+ "jsonrepair": "^3.14.1",
83
+ "kafkajs": "^2.2.4",
84
+ "openai": "6.18.0",
85
+ "pdfjs-dist": "^6.3.289",
86
+ "plist": "^3.1.0",
87
+ "uuid": "13.0.0",
88
+ "webdriverio": "9.26.1",
89
+ "xpath": "^0.0.34"
90
+ }
91
+ }
File without changes
@@ -1,62 +0,0 @@
1
- "use strict";
2
- // import { AutomationRunner } from "../core/main/runAutomationScript.js";
3
- // import { RuntimePromptRegistry } from "../framework/promptRegistry.runtime.js";
4
- // import { RuntimeActionRegistry } from "../framework/actionRegistry.runtime.js";
5
- // import { createDefaultPromptRegistry, registerDefaultPrompts } from "../framework/registerDefaultPrompts.js";
6
- // import { createDefaultActionRegistry, registerDefaultActions } from "../framework/registerDefaultActions.js";
7
- // // export { AutomationRunner };
8
- // // export { RuntimePromptRegistry };
9
- // // export { RuntimeActionRegistry };
10
- // // export { createDefaultPromptRegistry, registerDefaultPrompts };
11
- // // export { createDefaultActionRegistry, registerDefaultActions };
12
- // // import { AutomationRunner, RuntimeActionRegistry } from "ff-automationv2";
13
- // const actionRegistry = new RuntimeActionRegistry();
14
- // // actionRegistry.register("minimize", {
15
- // // handler: async (context) => {
16
- // // const browser = await context.session.getCurrentBrowser();
17
- // // await browser.minimizeWindow();
18
- // // context.scriptAppender.add({
19
- // // nlpName: "Minimize",
20
- // // elementsData: [],
21
- // // stepInputs: []
22
- // // });
23
- // // },
24
- // // requiresExecutor: true,
25
- // // requiresElement: false,
26
- // // requiresInput: false
27
- // // });
28
- // const runner = new AutomationRunner(20000, 15000, { actionRegistry });
29
- // runner.run({
30
- // userStory: "(open the browser ),( navigate to https://www.google.com/) ,(wait for 2 sec),(minimize the browser) ",
31
- // platform: "android",
32
- // pageDetails: {
33
- // Web: {
34
- // pageId: "PAG73a7a0ad-c092-4351-8a93-68647f60e343",
35
- // pageName: "ai-Page"
36
- // }
37
- // },
38
- // service_accounts: "",
39
- // serverHost: "https://test3.fireflink.com",
40
- // webSocketId: "",
41
- // generatedBy: "",
42
- // licenseType: "C-Professional",
43
- // licenseId: "LIC3985",
44
- // userId: "USR26935",
45
- // topic: "Topic-FIREFLINK-aiAutomation-Updates-test3",
46
- // projectType: "Web",
47
- // browser: {
48
- // browserName: "chrome",
49
- // },
50
- // serverData: {},
51
- // scriptName: "url",
52
- // scriptType: "android",
53
- // projectId: "PJT1116",
54
- // testCaseId: "SCR1208",
55
- // promptId: "3f6e123c-8ec6-47c1-90e1-1a2f53b49251",
56
- // userName: "default-user",
57
- // visionApikey: "Z3NrX2VubE44UVI5bmNzMlg0TXVsNDJHV0dkeWIzRllEYmJRV0lremZYaTRkME5VTzBjODZ4eHY=",
58
- // apiKey: "Z3NrX2VubE44UVI5bmNzMlg0TXVsNDJHV0dkeWIzRllEYmJRV0lremZYaTRkME5VTzBjODZ4eHY=",
59
- // model: "llama-3.3-70b-versatile",
60
- // serviceProvider: "Groq",
61
- // token: "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJEeE5VelJXSGhLTUVkSTVKQnV6eERFM3NsczVHRkV5cmJNeHVHNWtmNnRZIn0.eyJleHAiOjE3NzUyMjI3OTAsImlhdCI6MTc3MjYzMDc5MCwianRpIjoib25ydHJvOmY2ZDcwNzg1LTk4ODQtNDgzNS04ZjE2LWNiNzk5NjhiNWQzYSIsImlzcyI6Imh0dHA6Ly8xMDMuMTgyLjIxMC4yMjY6MzAxMDcvcmVhbG1zL0ZpcmVGbGluay10ZXN0MyIsImF1ZCI6InRhcmdldC1jbGllbnQiLCJzdWIiOiJmOmNhMzBmNDk3LTY1Y2YtNGU4Zi1iZGE3LTE0ZjM1NTNiYzZmNTpqYWlha2FzaEB5b3BtYWlsLmNvbSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImZsaW5rLXNlcnZpY2UiLCJzaWQiOiJhMzg0MTVkMS1hYWZkLTQ4MTYtOWNhYS01MGVmMGMxZWI0ODciLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIioiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImN1cnJlbnRMaWNlbnNlSWQiOiJMSUMzOTg1IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJjdXJyZW50UHJpdmlsZWdlIjoiU3VwZXIgQWRtaW4iLCJmdWxsTmFtZSI6ImphaSIsImFjdGl2YXRpb25TdGF0dXMiOiJBQ1RJVkUiLCJwcml2aWxlZ2UiOiJTdXBlciBBZG1pbiIsImxpY2Vuc2VOYW1lIjoiRmlyZUZsaW5rIC0gTElDMzk4NSIsInByZWZlcnJlZF91c2VybmFtZSI6ImphaSIsInVzZXJOYW1lIjoiamFpYWthc2hAeW9wbWFpbC5jb20iLCJiaWxsaW5nQ3ljbGUiOiJRdWFydGVybHkiLCJpZCI6IlVTUjI2OTM1IiwibGljZW5zZUlkIjoiTElDMzk4NSIsImVtYWlsIjoiamFpYWthc2hAeW9wbWFpbC5jb20ifQ.NCu_Oo86ld4tHCjWqTC2YxeBOifhWqwqmh1K7Cz6v4XEhDQuUrdULzKCOBWbYXA86BqT8oqWLOg2lA88G-LRnayCiBEutlbTbPIYsbghyuJCeagA_E9VJnM0fcccJqRi16dKG1em3cuZ2nJTQ8s_Bq1211ovPGI-Jyy2IBTc-fTDI0C4o9x8O0jpT_mz8COzCDwbCAon2e1EKxYjnyU360ZMwmwcnJjWqB5vsr384fKdrq3zx_zLESvW81x2bRGxzGYoO2hS38PWSrZbiOANNXzjVU9nDSU4kx280oBZo251rVRE58jJ4kKDSxLqmshT0TP-PERMqhNps9U2envExg",
62
- // })
@@ -1 +0,0 @@
1
- declare let system_prompt: string;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- let system_prompt = `You are given a 2D array of test steps. Each step is an array where the first element is a string describing the action, and optional additional elements may contain variable references.
3
-
4
- Your task is to extract structured data based on the following rules:
5
-
6
- 1. Find the FIRST occurrence of a step whose text contains "start iteration" (case-insensitive).
7
- 2. From that point, begin collecting all steps.
8
- 3. Continue collecting until you encounter the FIRST occurrence of a step whose text contains "End iteration" (case-insensitive) AFTER the start.
9
- 4. Include both the "start iteration" and "End iteration" steps.
10
- 5. STOP immediately after the first "End iteration".
11
- 6. Ignore all steps before and after this block.
12
-
13
- Data extraction rules:
14
- 7. From the "start iteration" step, extract the instance name inside single quotes.
15
- Example: "start iteration using 'Data1' Dataprovider" → instanceName = "Data1"
16
-
17
- 8. From each step, if a second element exists and contains text like "Dataprovider <variableName>", extract the variable name.
18
- Example: "Dataprovider val1" → "val1"
19
-
20
- 9. Collect all variable names into a list called "variables" (preserve order).
21
-
22
- Output format (STRICT):
23
-
24
- * Return ONLY valid JSON
25
- * No explanations or extra text
26
- * Use this exact structure:
27
-
28
- {
29
- "instanceName": "string",
30
- "variables": ["var1", "var2"],
31
- "steps": [ ...extracted steps... ]
32
- }
33
-
34
- Edge cases:
35
-
36
- * If no valid block is found, return:
37
- {
38
- "instanceName": "",
39
- "variables": [],
40
- "steps": []
41
- }
42
-
43
- `;
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const webdriverio_1 = require("webdriverio");
4
- async function main() {
5
- let browser;
6
- try {
7
- browser = await (0, webdriverio_1.remote)({
8
- capabilities: {
9
- browserName: 'chrome',
10
- },
11
- });
12
- await runScript(browser);
13
- }
14
- catch (err) {
15
- console.error('Error:', err);
16
- }
17
- finally {
18
- if (browser) {
19
- await browser.deleteSession();
20
- console.log('Session closed');
21
- }
22
- }
23
- }
24
- async function runScript(browser) {
25
- console.log('Starting script...');
26
- await browser.url('https://example.com');
27
- const title = await browser.getTitle();
28
- console.log('Title:', title);
29
- await browser.url('https://google.com');
30
- const title2 = await browser.getTitle();
31
- console.log('Title:', title2);
32
- console.log('Done!');
33
- }
34
- main();
File without changes
package/dist/tests/poc.js DELETED
@@ -1,212 +0,0 @@
1
- "use strict";
2
- // import { remote } from 'webdriverio';
3
- // import { DomSimplifier } from "../domAnalysis/simplifyAndFlatten.js";
4
- // import { DomSearcher } from "../domAnalysis/searchBest.js";
5
- // import { DomRelationshipBuilder } from "../domAnalysis/relativeElementsFromDom.js";
6
- // import { getAnnotatedDOM } from "../utils/DomExtraction/jsForAttributeInjection.js"
7
- // import { ElementGetter } from "../fireflinkData/fireflinkLocators/getListOfLocators.js";
8
- // import OpenAI from "openai";
9
- // import { DomProcessingEngine } from "../domAnalysis/getRelaventElements.js"
10
- // let simplifier = new DomSimplifier();
11
- // let searcher = new DomSearcher();
12
- // let relationshipBuilder = new DomRelationshipBuilder();
13
- // let data = new ElementGetter()
14
- // const client = new OpenAI({
15
- // baseURL: "https://api.groq.com/openai/v1",
16
- // apiKey: "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",
17
- // });
18
- // async function generateIndex(step: any, extractedDomJson: any) {
19
- // let prompt = `
20
- // -You are an intelligent assistant that extracts structured UI action data.
21
- // -Given a structured UI JSON representation with uniquely identified elements (ff-inspect values like Fire-Flink-0, Fire-Flink-1, Fire-Flink-2, Fire-Flink-3... in DOM order),
22
- // -locate the most appropriate element for an automation step by performing keyword-based matching using exact, partial, and fuzzy strategies, and
23
- // return the identifier of the best match.
24
- // Return **only valid JSON** in the following format:
25
- // {
26
- // "attribute_value": "Fire-Flink-x",
27
- // "action": "x",
28
- // "input_text": "x",
29
- // "elementType": "x"
30
- // }
31
- // Rules:
32
- // You are an AI assistant. For the step : ${step}, extract the element keyword from the step (the field name like 'Leaving from', 'Going To').
33
- // - Simplified JSON: ${JSON.stringify(extractedDomJson)} — if it is empty, null, or has no valid data, return strictly "attribute_value":"Fire-Flink-0" and never use any other Fire-Flink-x value.
34
- // - Select the closest semantic match to step and return only its attribute_value, else Fire-Flink-0.
35
- // - **Find the FF-inspecter attribute value of the element in the Simplified JSON whose text or attributes best match the atep.**
36
- // - If multiple matches exist, use the reference element and choose the closest match by ff-inspect distance.
37
- // important example: step: "click on login below user login"
38
- // simplified json:
39
- // login - ff-inspect-300
40
- // user login - ff-inspect-790
41
- // login - ff-inspect-803
42
- // then should return login - ff-inspect-803 witch is near to user reference element user login - ff-inspect-790
43
- // `;
44
- // const response = await client.responses.create({
45
- // model: "openai/gpt-oss-20b",
46
- // input: prompt,
47
- // });
48
- // return JSON.parse(response.output_text);
49
- // }
50
- // async function generateKeywords(elementName: string) {
51
- // const prompt = `
52
- // You are an AI that generates keyword variations for identifying form elements in the DOM.
53
- // Given an element name, return ONLY a JSON array of relevant human-readable variations that could be used to identify that element in UI labels, placeholders, or attributes.
54
- // Rules:
55
- // - Return strictly a JSON array (no explanation, no extra text)
56
- // - Include common variations, phrasing, and synonyms
57
- // - Keep the list concise and relevant
58
- // - Do NOT include unrelated terms
59
- // - Do NOT include misspellings
60
- // Example:
61
- // Input: email
62
- // Output:
63
- // [
64
- // "email",
65
- // "email address",
66
- // "e-mail",
67
- // "mail",
68
- // "user email",
69
- // ]
70
- // Now generate the output for:
71
- // ${elementName}
72
- // `;
73
- // const response = await client.responses.create({
74
- // model: "openai/gpt-oss-20b",
75
- // input: prompt,
76
- // }
77
- // ,);
78
- // return response.output_text;
79
- // }
80
- // const steps = [
81
- // { action: "Open Browser" },
82
- // { action: "Maximize Browser" },
83
- // { action: "Navigate", value: "file:///D:/Bitbucket/testCase_Search/login.html" },
84
- // {
85
- // action: "Enter Text",
86
- // value: "test@example.com",
87
- // elementName: "email",
88
- // locators: [
89
- // { type: "id", value: "email" },
90
- // { type: "xpath", value: "//input[@type='email']" },
91
- // { type: "css", value: "input[placeholder='Enter Email']" }
92
- // ]
93
- // },
94
- // {
95
- // action: "Enter Text",
96
- // value: "123456",
97
- // locators: [
98
- // { type: "id", value: "password" },
99
- // { type: "xpath", value: "//input[@type='password']" },
100
- // { type: "css", value: "input[placeholder='Enter Password']" }
101
- // ]
102
- // },
103
- // {
104
- // action: "Click",
105
- // elementName: "login",
106
- // locators: [
107
- // { type: "xpath", value: "//button[text()='SignIn']" },
108
- // { type: "css", value: "buttoin" },
109
- // { type: "xpath", value: "//button[contains(text(),'SignInbtn')]" }
110
- // ]
111
- // },
112
- // ];
113
- // // ---------- ENGINE ----------
114
- // class Engine {
115
- // browser: WebdriverIO.Browser;
116
- // constructor(browser: WebdriverIO.Browser) {
117
- // this.browser = browser;
118
- // }
119
- // async open_browser() {
120
- // console.log("[STEP] Open Browser");
121
- // }
122
- // async maximize_browser() {
123
- // await this.browser.maximizeWindow();
124
- // console.log("[STEP] Maximize Browser");
125
- // }
126
- // async navigate(path: string) {
127
- // await this.browser.url(path);
128
- // console.log(`[STEP] Navigate → ${path}`);
129
- // }
130
- // async findElement(locators: any[]) {
131
- // for (const locator of locators) {
132
- // try {
133
- // let selector = "";
134
- // if (locator.type === "id") {
135
- // selector = `#${locator.value}`;
136
- // } else if (locator.type === "css") {
137
- // selector = locator.value;
138
- // } else if (locator.type === "xpath") {
139
- // selector = locator.value;
140
- // }
141
- // const element = await this.browser.$(selector);
142
- // if (await element.isExisting()) {
143
- // return element;
144
- // }
145
- // } catch (e) {
146
- // continue;
147
- // }
148
- // }
149
- // throw new Error("Element not found");
150
- // }
151
- // async enter_text(step: any) {
152
- // const element = await this.findElement(step.locators);
153
- // await element.setValue(step.value);
154
- // console.log(`[STEP] Enter Text → ${step.value}`);
155
- // }
156
- // async click(step: any) {
157
- // const element = await this.findElement(step.locators);
158
- // await element.click();
159
- // console.log("[STEP] Click");
160
- // }
161
- // async verify_text(step: any) {
162
- // const element = await this.findElement(step.locators);
163
- // const isDisplayed = await element.isDisplayed();
164
- // if (isDisplayed) {
165
- // console.log(`[PASS] Found → ${step.value}`);
166
- // } else {
167
- // console.log(`[FAIL] Not Found → ${step.value}`);
168
- // }
169
- // }
170
- // async close_browser() {
171
- // await this.browser.deleteSession();
172
- // console.log("[STEP] Close Browser");
173
- // }
174
- // }
175
- // // ---------- ACTION MAPPER ----------
176
- // function actionToMethod(action: string): string {
177
- // return action.toLowerCase().replace(/ /g, "_");
178
- // }
179
- // let browser
180
- // // ---------- MAIN EXECUTION ----------
181
- // (async () => {
182
- // browser = await remote({
183
- // logLevel: 'error',
184
- // capabilities: {
185
- // browserName: 'chrome'
186
- // }
187
- // });
188
- // const engine = new Engine(browser);
189
- // for (const step of steps) {
190
- // try {
191
- // const methodName = actionToMethod(step.action);
192
- // const method: any = (engine as any)[methodName];
193
- // if (step.value && !step.locators) {
194
- // await method.call(engine, step.value);
195
- // } else {
196
- // await method.call(engine, step);
197
- // }
198
- // } catch (error) {
199
- // let domInfo = await getAnnotatedDOM(browser);
200
- // const domProcessor = new DomProcessingEngine();
201
- // let extractedRelevantDom = domProcessor.webProcess({
202
- // keywords: await generateKeywords(JSON.stringify(step)),
203
- // rawDom: domInfo.dom,
204
- // stepCount: 1
205
- // });
206
- // console.log(await generateIndex(JSON.stringify(step), extractedRelevantDom))
207
- // let newData = await data.getFireFlinkElement(domInfo.dom, "[ff-inspect='Fire-Flink-8']")
208
- // console.log(newData)
209
- // break;
210
- // }
211
- // }
212
- // })();
File without changes