ff-automationv2 2.2.15 → 2.2.16

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.
File without changes
@@ -0,0 +1,62 @@
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
+ // })
@@ -0,0 +1 @@
1
+ declare let system_prompt: string;
@@ -0,0 +1,43 @@
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
+ `;
@@ -0,0 +1,6 @@
1
+ declare function findMaxNonNestedPatterns<T>(arr: T[]): {
2
+ pattern: T[];
3
+ count: number;
4
+ startIndexes: number[];
5
+ }[];
6
+ declare const arr: number[];
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ function findMaxNonNestedPatterns(arr) {
3
+ const results = [];
4
+ let i = 0;
5
+ while (i < arr.length) {
6
+ let best = null;
7
+ for (let size = 1; size <= Math.floor((arr.length - i) / 2); size++) {
8
+ const pattern = arr.slice(i, i + size);
9
+ let j = i;
10
+ let count = 0;
11
+ const indexes = [];
12
+ while (j + size <= arr.length) {
13
+ let match = true;
14
+ for (let k = 0; k < size; k++) {
15
+ if (arr[j + k] !== pattern[k]) {
16
+ match = false;
17
+ break;
18
+ }
19
+ }
20
+ if (!match)
21
+ break;
22
+ indexes.push(j);
23
+ count++;
24
+ j += size;
25
+ }
26
+ if (count > 1) {
27
+ // 🔥 Keep ONLY longest pattern (removes nested duplicates)
28
+ if (!best || pattern.length > best.pattern.length) {
29
+ best = { pattern, count, startIndexes: indexes };
30
+ }
31
+ }
32
+ }
33
+ if (best) {
34
+ results.push(best);
35
+ // 🔥 Skip entire block (avoid re-detection)
36
+ const last = best.startIndexes[best.startIndexes.length - 1];
37
+ i = last + best.pattern.length;
38
+ }
39
+ else {
40
+ i++;
41
+ }
42
+ }
43
+ return results;
44
+ }
45
+ const arr = [1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 3, 4, 1, 2, 1, 2, 1, 2, 1, 2];
46
+ console.log(findMaxNonNestedPatterns(arr));
@@ -0,0 +1,7 @@
1
+ type SessionState = {
2
+ testCase: string;
3
+ env: "local" | "cloud";
4
+ isTerminate: boolean;
5
+ };
6
+ declare let sessionList: SessionState[];
7
+ declare const founds1: boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ let sessionList = [
3
+ { testCase: "A", env: "local", isTerminate: false },
4
+ { testCase: "B", env: "cloud", isTerminate: false },
5
+ { testCase: "B", env: "cloud", isTerminate: true },
6
+ { testCase: "C", env: "local", isTerminate: false }
7
+ ];
8
+ sessionList = sessionList.filter(item => !(item.testCase === "B" && item.env === "cloud" && item.isTerminate === true));
9
+ const founds1 = sessionList.some(item => item.testCase === "A" &&
10
+ item.env === "local" &&
11
+ item.isTerminate === false);
12
+ console.log(sessionList);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ import { AutomationRunner } from "../index.js";
2
+ import path from "path";
3
+ const runner = new AutomationRunner();
4
+ runner.run({
5
+ userStory: [
6
+ ["Open browser"],
7
+ ["Navigate to https://www.google.com/"],
8
+ ["Maximize the browser"],
9
+ // ["Navigate to https://www.google.com/"],
10
+ // ["Maximize the browser"],
11
+ // ["Navigate to https://www.google.com/"],
12
+ // ["Maximize the browser"],
13
+ // ["click on Gmail link"],
14
+ ["Close browser"],
15
+ // ["start iteration using 'Data1' Dataprovider"],
16
+ // ["enter 'startIteration1' in search field"],
17
+ // ["enter level-A in search field"],
18
+ // ["start iteration using 'Data1' Dataprovider"],
19
+ // ["enter 'startIteration1' in search field"],
20
+ // ["enter level-B in search field"],
21
+ // ["End iteration"],
22
+ // ["End iteration"],
23
+ // ["click on Gmail link"],
24
+ // ["Close browser"],
25
+ ],
26
+ platform: "web",
27
+ pageDetails: {
28
+ Web: {
29
+ pageId: "PAG73a7a0ad-c092-4351-8a93-68647f60e343",
30
+ pageName: "ai-Page"
31
+ }
32
+ },
33
+ sessionPath: path.join("D:", "Bitbucket", "automationV2"),
34
+ serverHost: "test3",
35
+ // topic: "",
36
+ // serviceAccounts: "",
37
+ webSocketId: "",
38
+ generatedBy: "",
39
+ licenseType: "C-Professional",
40
+ licenseId: "LIC3985",
41
+ userId: "USR26935",
42
+ projectType: "Web",
43
+ browser: {
44
+ browserName: "chrome",
45
+ },
46
+ serverData: "https://test3.fireflink.com",
47
+ version: "asdfg",
48
+ type: "sdfg",
49
+ scriptName: "url",
50
+ scriptType: "web",
51
+ projectId: "PJT1116",
52
+ testCaseId: "SCR1208",
53
+ promptId: "3f6e123c-8ec6-47c1-90e1-1a2f53b49251",
54
+ userName: "default-user",
55
+ appiumPort: 0,
56
+ platformVersion: "",
57
+ realDeviceId: "",
58
+ isCloud: false,
59
+ cloudConfig: {
60
+ accessKey: "yfAa_w199cJge2Gezsgb2Jnu7hKdqER1tExY5kKvgSvXfi1lRUelFsbTFI5pMq7zQuwwNXXnsLTkjKhvWcKDWsUoGLi9KjUV6gbUNDhqj0jWYFyW9h_0LIDEg5qXigwZdqzQqAvWwHin3gBhzGndeROtixv_VFhnseGSWRAHTajZzE-Zl0d8BP6gl0TEBUfoNgqBtAQVDLP6wAQzPfcyjjGFsdHkXWeHFkKmA78D7rKlnNuN2WgjIUlhYheDRDeqZ98Ig_PyS1GbUvjwJ73L38sr_cD4Y9lrKyWJV-m5RmtKhmkqRM8uk5gEfjzgwy30",
61
+ hostname: "devicefarm.fireflink.com",
62
+ licenseId: "LIC2026658",
63
+ projectName: "Project-6",
64
+ protocol: "https",
65
+ path: "backend/fireflinkcloud/wd/hub"
66
+ },
67
+ capabilities: {
68
+ browserName: "chrome",
69
+ platformName: "Windows 11",
70
+ browserVersion: "146"
71
+ },
72
+ isTerminate: false,
73
+ token: "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJRUFRfTnFuMkxxdDVmN09tOElWaW53dUJlR3ZVUUVBUkdxZkFuRHJxZU9NIn0.eyJleHAiOjE3NzUwNDMwMjcsImlhdCI6MTc3NDk1NjYyNywianRpIjoib25ydHJvOjk5MjQwN2U3LWU2ZWQtNDUwMS05NDhhLTA2YmQyMGIwZmNhZSIsImlzcyI6Imh0dHA6Ly8xMDMuMTgyLjIxMC4yMjY6MzAxMDcvcmVhbG1zL0ZpcmVGbGluay10ZXN0MyIsImF1ZCI6InRhcmdldC1jbGllbnQiLCJzdWIiOiJmOmNhMzBmNDk3LTY1Y2YtNGU4Zi1iZGE3LTE0ZjM1NTNiYzZmNTpqYWlha2FzaEB5b3BtYWlsLmNvbSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImZsaW5rLXNlcnZpY2UiLCJzaWQiOiI1NGVlNDQ0YS0zMzdkLTQwNjMtYjhlZC0yOWI2ZTFmZjBhN2YiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIioiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImN1cnJlbnRMaWNlbnNlSWQiOiJMSUMzOTg1IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJjdXJyZW50UHJpdmlsZWdlIjoiU3VwZXIgQWRtaW4iLCJmdWxsTmFtZSI6ImphaSIsImFjdGl2YXRpb25TdGF0dXMiOiJBQ1RJVkUiLCJwcml2aWxlZ2UiOiJTdXBlciBBZG1pbiIsImxpY2Vuc2VOYW1lIjoiRmlyZUZsaW5rIC0gTElDMzk4NSIsInByZWZlcnJlZF91c2VybmFtZSI6ImphaSIsInVzZXJOYW1lIjoiamFpYWthc2hAeW9wbWFpbC5jb20iLCJiaWxsaW5nQ3ljbGUiOiJRdWFydGVybHkiLCJpZCI6IlVTUjI2OTM1IiwibGljZW5zZUlkIjoiTElDMzk4NSIsImVtYWlsIjoiamFpYWthc2hAeW9wbWFpbC5jb20ifQ.u_ZqC8OLDQCPyqd-7Y8iby0ylHJq5MRXzSxQ0fHv8ofWPYEeOW428NKJEnddddqvgGYxY-oYm9QbalDxqt3KGPnrMPfDvD1KyoVEAisZEq6N_DvN5G0OunH5pEMtubfGJVTKRlAE1OZfHETZrfe5vveKBmycJbeR8_nAdhsu3TGovAwkhGHUeeDIvR_5q0i-Rw_XasXn2Vx7T4l05kdPlu_-9a5J4MIRm3fA7IT9LV2wy63-7alnB1btx2Z4nU2yLcSWdr2gWKNz8a_ulPa2aDHZK-0AyEUtn9-WnLPwV5ZEbGcTDxt-ybN2FKnNIKrI8Ka0RGDyfTTYK50xUlNOIQ"
74
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,82 @@
1
+ import { remote } from 'webdriverio';
2
+ import { encode } from '@toon-format/toon';
3
+ import * as cheerio from 'cheerio';
4
+ import fs from 'fs';
5
+ import { encoding_for_model } from "@dqbd/tiktoken";
6
+ // 🔄 HTML → JSON
7
+ function htmlToJson(html) {
8
+ const $ = cheerio.load(html);
9
+ // 🧹 remove useless elements
10
+ $('script, style, noscript, iframe').remove();
11
+ function parseElement(elem, depth = 0) {
12
+ if (!elem || depth > 6)
13
+ return null;
14
+ const node = {
15
+ tag: elem.name,
16
+ attrs: elem.attribs || {},
17
+ children: [] // ✅ FIX
18
+ };
19
+ for (const child of elem.children || []) {
20
+ if (child.type === 'text') {
21
+ const text = child.data.trim();
22
+ if (text) {
23
+ node.children.push({ text });
24
+ }
25
+ }
26
+ else if (child.type === 'tag') {
27
+ const parsed = parseElement(child, depth + 1);
28
+ if (parsed) {
29
+ node.children.push(parsed);
30
+ }
31
+ }
32
+ }
33
+ return node;
34
+ }
35
+ return parseElement($('body')[0]);
36
+ }
37
+ // 🚀 Main runner
38
+ async function run() {
39
+ const browser = await remote({
40
+ capabilities: {
41
+ browserName: 'chrome'
42
+ }
43
+ });
44
+ try {
45
+ // 🌐 Open Amazon
46
+ await browser.url('https://www.amzon.in/');
47
+ // ⏳ wait for search box
48
+ const searchBox = await browser.$('#twotabsearchtextbox');
49
+ await searchBox.waitForDisplayed({ timeout: 10000 });
50
+ // 📄 Get HTML
51
+ const html = await browser.getPageSource();
52
+ // 🔄 Convert HTML → JSON
53
+ const json = htmlToJson(html);
54
+ // 🔄 JSON → TOON
55
+ const start = performance.now();
56
+ const encoded = encode({ data: json });
57
+ const end = performance.now();
58
+ console.log('HTML :', html.length);
59
+ console.log('json size:', JSON.stringify(json).length);
60
+ console.log('Encoded length:', encoded.length);
61
+ console.log(`Time taken: ${(end - start).toFixed(2)} ms`);
62
+ // 💾 Save outputs (optional but useful)
63
+ fs.writeFileSync('output.json', JSON.stringify(json, null, 2));
64
+ fs.writeFileSync('output.toon', encoded);
65
+ const enc = encoding_for_model("gpt-4"); // closest available
66
+ function countTokens(text) {
67
+ return enc.encode(text).length;
68
+ }
69
+ const jsonString = JSON.stringify(json);
70
+ console.log("Token JSON count:", countTokens(jsonString));
71
+ const jsonStringencoded = JSON.stringify(encoded);
72
+ console.log("Token TOON count:", countTokens(jsonStringencoded));
73
+ }
74
+ catch (err) {
75
+ console.error(err);
76
+ }
77
+ finally {
78
+ await browser.deleteSession();
79
+ }
80
+ }
81
+ run();
82
+ console.log("hi");
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { remote } from "webdriverio";
2
+ async function runTest() {
3
+ const browser = await remote({
4
+ logLevel: "debug",
5
+ protocol: "https",
6
+ hostname: "devicefarm.fireflink.com",
7
+ port: 443,
8
+ path: "/backend/fireflinkcloud/wd/hub",
9
+ capabilities: {
10
+ browserName: "chrome",
11
+ platformName: "Windows 11",
12
+ browserVersion: "146",
13
+ "devicefarm:networkLogEnable": false,
14
+ "fireflink:deviceType": "public",
15
+ // 🔹 Query params moved here
16
+ "fireflink:accessKey": "yfAa_w199cJge2Gezsgb2Jnu7hKdqER1tExY5kKvgSvXfi1lRUelFsbTFI5pMq7zQuwwNXXnsLTkjKhvWcKDWsUoGLi9KjUV6gbUNDhqj0jWYFyW9h_0LIDEg5qXigwZdqzQqAvWwHin3gBhzGndeROtixv_VFhnseGSWRAHTajZzE-Zl0d8BP6gl0TEBUfoNgqBtAQVDLP6wAQzPfcyjjGFsdHkXWeHFkKmA78D7rKlnNuN2WgjIUlhYheDRDeqZ98Ig_PyS1GbUvjwJ73L38sr_cD4Y9lrKyWJV-m5RmtKhmkqRM8uk5gEfjzgwy30",
17
+ "fireflink:licenseId": "LIC2026658",
18
+ "fireflink:projectName": "Project-6",
19
+ },
20
+ });
21
+ await browser.url("https://www.google.com");
22
+ await browser.deleteSession();
23
+ }
24
+ runTest();
25
+ console.log("hi");
@@ -0,0 +1 @@
1
+ export declare const testdata: Record<string, any>;
@@ -0,0 +1,5 @@
1
+ export const testdata = {
2
+ Data1: {
3
+ startIteration1: [1, 2, 3],
4
+ }
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-automationv2",
3
- "version": "2.2.15",
3
+ "version": "2.2.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "This lib is used to automate the manual testcase",