ff-automationv2 2.2.24 → 2.2.25
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.
- package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +2 -2
- package/dist/ai/llmprompts/systemPrompts/errorDescriptionPrompt.js +1 -1
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.js +1 -1
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +1 -1
- package/dist/ai/llmprompts/systemPrompts/getActionExtractorPrompt.js +3 -3
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.js +4 -2
- package/dist/ai/llmprompts/systemPrompts/visionPrompt.js +1 -0
- package/dist/automation/actions/executor.d.ts +1 -1
- package/dist/automation/actions/executor.js +2 -1
- package/dist/automation/actions/interaction/clear/clear.js +1 -1
- package/dist/automation/actions/interaction/clear/clearAndEnter.js +1 -1
- package/dist/automation/actions/interaction/click/click.js +1 -1
- package/dist/automation/actions/interaction/click/clickNtimes.js +1 -1
- package/dist/automation/actions/interaction/click/doubleClick.js +1 -1
- package/dist/automation/actions/interaction/click/waitAndClick.js +1 -1
- package/dist/automation/actions/interaction/dragAndDrop/dragAndDrop.js +1 -1
- package/dist/automation/actions/interaction/enterActions/EnterInputIntoElementFromClipBoardInterface_mob.js +1 -1
- package/dist/automation/actions/interaction/enterActions/enterInput.js +1 -1
- package/dist/automation/actions/interaction/enterActions/enterInputAndPress.js +1 -1
- package/dist/automation/actions/interaction/find/MOB_FindElement.js +2 -2
- package/dist/automation/actions/interaction/find/findElements.js +3 -4
- package/dist/automation/actions/interaction/get/MOB_GetHeightOfElement.js +1 -1
- package/dist/automation/actions/interaction/get/MOB_GetTextFromElementAndSetToClipBoard.js +1 -1
- package/dist/automation/actions/interaction/get/MOB_GetWidthOfElement.js +1 -1
- package/dist/automation/actions/interaction/get/getAttribute.js +1 -1
- package/dist/automation/actions/interaction/get/getListOfElementsFromLocatorTypeLocatorValue.js +1 -1
- package/dist/automation/actions/interaction/get/getLocation.js +1 -1
- package/dist/automation/actions/interaction/get/getRect.js +2 -2
- package/dist/automation/actions/interaction/get/getSize.js +1 -1
- package/dist/automation/actions/interaction/get/getSizeOfBrowserWindow.js +3 -0
- package/dist/automation/actions/interaction/get/getTagName.js +1 -1
- package/dist/automation/actions/interaction/get/getText.js +1 -1
- package/dist/automation/actions/interaction/get/getWidthOfWebElement.js +2 -0
- package/dist/automation/actions/interaction/get/getXLocationOfBrowserWindow.js +2 -0
- package/dist/automation/actions/interaction/get/getXLocationOfWebElement.js +1 -1
- package/dist/automation/actions/interaction/get/getYLocationOfWebElement.js +1 -1
- package/dist/automation/actions/interaction/maximize/maximize.js +2 -2
- package/dist/automation/actions/interaction/pinch/PinchInByPercentMob.js +3 -3
- package/dist/automation/actions/interaction/pinch/PinchOutByPercentMob.js +1 -3
- package/dist/automation/actions/interaction/press/longPress.js +1 -1
- package/dist/automation/actions/interaction/swipe/swipeDownToElement.js +6 -9
- package/dist/automation/actions/interaction/swipe/swipeLeftToElement.js +6 -9
- package/dist/automation/actions/interaction/swipe/swipeRightToElement.js +6 -9
- package/dist/automation/actions/interaction/swipe/swipeUpToElement.js +6 -9
- package/dist/automation/actions/interaction/swipe/swipeUpToElementForMWeb.js +5 -5
- package/dist/automation/actions/interaction/swipe/swipeUsingReferenceElement.js +71 -76
- package/dist/automation/actions/interaction/verify/VerifyAllOptionsAreDeSelected.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyCheckBoxIsNotSelected.js +2 -1
- package/dist/automation/actions/interaction/verify/VerifyElementIsClickable.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyElementIsDisabled.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyElementIsDisplayed.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyElementIsEnabled.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyElementIsSelected.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyElementNotContainsText.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyHeightOfWebElement.js +2 -2
- package/dist/automation/actions/interaction/verify/VerifyIfXAndYCoordinateOfElement.js +5 -5
- package/dist/automation/actions/interaction/verify/VerifyNumberOfElementsByTagName.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyNumberOfElementsByXpath.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyWidthOfElement.js +3 -3
- package/dist/automation/actions/interaction/verify/VerifyXLocationOfElement.js +3 -3
- package/dist/automation/actions/interaction/verify/VerifyYLocationOfElement.js +3 -3
- package/dist/automation/actions/interaction/verify/verifypartialtext.js +1 -1
- package/dist/automation/actions/interaction/verify/verifytext.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillAttributeOfElementContainsString.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsEnabled.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsInvisible.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsSelected.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsVisible.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillStalenessOfElement.js +1 -1
- package/dist/automation/actions/interface/verifyActionInterface.d.ts +1 -0
- package/dist/automation/mobileSession/initiateMobileSession.d.ts +2 -1
- package/dist/automation/mobileSession/initiateMobileSession.js +4 -3
- package/dist/core/constants/allAction.js +1 -0
- package/dist/core/constants/supportedActions.js +29 -2
- package/dist/core/interfaces/actionInterface.d.ts +1 -1
- package/dist/core/interfaces/executionDetails.d.ts +1 -0
- package/dist/core/interfaces/llmConfigurationInterface.d.ts +1 -1
- package/dist/core/main/actionHandlerFactory.js +6 -3
- package/dist/core/main/executionContext.js +1 -1
- package/dist/core/main/runAutomationScript.js +21 -21
- package/dist/imageAnalysisMobile/annotatedScreenshotMobile.js +1 -1
- package/dist/imageAnalysisWeb/annotateScreenshot.js +1 -1
- package/dist/llmConfig/llmConfiguration.d.ts +1 -2
- package/dist/llmConfig/llmConfiguration.js +15 -13
- package/dist/tests/test1.d.ts +1 -7
- package/dist/tests/test1.js +29 -11
- package/dist/tests/test12.d.ts +0 -1
- package/dist/tests/test12.js +73 -72
- package/dist/tests/testkaf.d.ts +1 -0
- package/dist/tests/testkaf.js +56 -0
- package/dist/tests/testwe.d.ts +1 -0
- package/dist/tests/testwe.js +24 -0
- package/dist/utils/DomExtraction/jsForAttributeInjection.d.ts +1 -1
- package/dist/utils/DomExtraction/jsForAttributeInjection.js +11 -7
- package/dist/utils/InstancesDetails/getInstancesInfo.js +2 -1
- package/dist/utils/swipe/domSearchHelper.d.ts +1 -1
- package/dist/utils/swipe/domSearchHelper.js +45 -21
- package/package.json +5 -4
|
@@ -6,12 +6,13 @@ const child_process_1 = require("child_process");
|
|
|
6
6
|
const logData_js_1 = require("../../utils/logger/logData.js");
|
|
7
7
|
const initiateCloudSession_js_1 = require("../cloudSession/initiateCloudSession.js");
|
|
8
8
|
class MobileSession {
|
|
9
|
-
constructor(appiumPort, isCloud, capabilities, CloudConfig) {
|
|
9
|
+
constructor(appiumPort, isCloud, capabilities, CloudConfig, adbPath) {
|
|
10
10
|
this.driver = null;
|
|
11
11
|
this.currentAppPackage = "";
|
|
12
12
|
this.appiumPort = appiumPort;
|
|
13
13
|
this.isCloud = isCloud;
|
|
14
14
|
this.cloudSessionInstances = new initiateCloudSession_js_1.CloudSession(capabilities, CloudConfig);
|
|
15
|
+
this.adbPath = adbPath;
|
|
15
16
|
}
|
|
16
17
|
async openApp(arg) {
|
|
17
18
|
try {
|
|
@@ -42,8 +43,8 @@ class MobileSession {
|
|
|
42
43
|
throw new Error("Appium server is not running or unreachable.", { cause: error });
|
|
43
44
|
}
|
|
44
45
|
try {
|
|
45
|
-
await (0, child_process_1.execSync)(
|
|
46
|
-
await (0, child_process_1.execSync)(
|
|
46
|
+
await (0, child_process_1.execSync)(`${this.adbPath} -s ${arg.capabilities["appium:udid"]} shell pm clear ${appPackage}`).toString();
|
|
47
|
+
await (0, child_process_1.execSync)(`${this.adbPath} -s ${arg.capabilities["appium:udid"]} shell am start -n ${appPackage}/${appActivity}`).toString();
|
|
47
48
|
}
|
|
48
49
|
catch (error) {
|
|
49
50
|
const output = error.stderr?.toString() || error.message || "";
|
|
@@ -4,7 +4,7 @@ exports.ELEMENTLESS_ACTION = exports.INPUTLESS_ACTIONS = void 0;
|
|
|
4
4
|
exports.INPUTLESS_ACTIONS = [
|
|
5
5
|
"open",
|
|
6
6
|
"openApp",
|
|
7
|
-
"
|
|
7
|
+
"navigateBack",
|
|
8
8
|
"refresh",
|
|
9
9
|
"navigate",
|
|
10
10
|
"maximize",
|
|
@@ -187,5 +187,32 @@ exports.ELEMENTLESS_ACTION = [
|
|
|
187
187
|
"VerifyTitleOfCurrentPage",
|
|
188
188
|
"VerifyAllBrowserWindowsClosed",
|
|
189
189
|
"VerifyHexCodeForGivenXYCoordinates",
|
|
190
|
-
"VerifyIfXAndYCoordinateOfElement"
|
|
190
|
+
"VerifyIfXAndYCoordinateOfElement",
|
|
191
|
+
"GetSystemProperty",
|
|
192
|
+
"GetValueOfSystemVariable",
|
|
193
|
+
"GetStringDataFromLocalFile",
|
|
194
|
+
"GetValueFromXmlPath",
|
|
195
|
+
"GetAllBrokenImages",
|
|
196
|
+
"GetAllBrokenLinkCount",
|
|
197
|
+
"GetAllBrokenLinks",
|
|
198
|
+
"GetBestPracticesScore",
|
|
199
|
+
"GetCapabilityNames",
|
|
200
|
+
"GetCollectiveApiResponseTime",
|
|
201
|
+
"GetCollectiveApiStatusCode",
|
|
202
|
+
"GetDataFromApiRequestHeaderForJsonPath",
|
|
203
|
+
"GetDataFromApiResponseForJsonPath",
|
|
204
|
+
"GetDateWithGivenFormat",
|
|
205
|
+
"GetListOfElementsFromLocatorTypeLocatorValue",
|
|
206
|
+
"GetNumberOfBrokenImages",
|
|
207
|
+
"GetPwaScore",
|
|
208
|
+
"GetSeoScore",
|
|
209
|
+
"GetSingleApiRequestPayload",
|
|
210
|
+
"GetSingleApiResponse",
|
|
211
|
+
"GetSingleApiResponseTime",
|
|
212
|
+
"GetSingleApiStatusCode",
|
|
213
|
+
"GetTextPresentOnAlertPopup",
|
|
214
|
+
"GetTunnelIdentifier",
|
|
215
|
+
"GetValueByCookieName",
|
|
216
|
+
"GetValueFromLocalStorage",
|
|
217
|
+
"GetWorkingLinksFromCurrentPage",
|
|
191
218
|
];
|
|
@@ -140,7 +140,7 @@ export interface IActionExecutor {
|
|
|
140
140
|
VerifyBrowserWindowTitleContainsString(value: string, platform: string): Promise<void>;
|
|
141
141
|
VerifyBrowserWindowUrlIsString(value: string, platform: string): Promise<void>;
|
|
142
142
|
VerifyBrowserWindowUrlContainsExpectedUrl(value: string, platform: string): Promise<void>;
|
|
143
|
-
VerifyCheckBoxIsNotSelected(pageDOM: string, selector: string, fireflinkIndex: string, elementName: string, elementType: string, platform: string): Promise<void>;
|
|
143
|
+
VerifyCheckBoxIsNotSelected(pageDOM: string, selector: string, value: string, fireflinkIndex: string, elementName: string, elementType: string, platform: string): Promise<void>;
|
|
144
144
|
VerifyCheckBoxIsSelected(pageDOM: string, selector: string, fireflinkIndex: string, elementName: string, elementType: string, platform: string): Promise<void>;
|
|
145
145
|
VerifyBrowserWindowTitleIsString(value: string, platform: string): Promise<void>;
|
|
146
146
|
VerifyIfBrowserWindowIsClosed(platform: string): Promise<void>;
|
|
@@ -88,7 +88,7 @@ function createActionHandlers(context) {
|
|
|
88
88
|
try {
|
|
89
89
|
await context.androidSession.close();
|
|
90
90
|
context.scriptAppender.add(async () => ({
|
|
91
|
-
nlpName: "
|
|
91
|
+
nlpName: "MOB_CloseApp",
|
|
92
92
|
elementsData: [],
|
|
93
93
|
stepInputs: []
|
|
94
94
|
}));
|
|
@@ -107,7 +107,7 @@ function createActionHandlers(context) {
|
|
|
107
107
|
minimize: withExecutor(async (executor) => {
|
|
108
108
|
await executor.minimize();
|
|
109
109
|
}),
|
|
110
|
-
|
|
110
|
+
navigateBack: withExecutor(async (executor) => {
|
|
111
111
|
await executor.goBack();
|
|
112
112
|
}),
|
|
113
113
|
refresh: withExecutor(async (executor) => {
|
|
@@ -122,6 +122,9 @@ function createActionHandlers(context) {
|
|
|
122
122
|
Click: withExecutor(async (executor, result) => {
|
|
123
123
|
await executor.click(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
124
124
|
}),
|
|
125
|
+
Select: withExecutor(async (executor, result) => {
|
|
126
|
+
await executor.click(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
127
|
+
}),
|
|
125
128
|
RightClick: withExecutor(async (executor, result) => {
|
|
126
129
|
await executor.rightClick(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
127
130
|
}),
|
|
@@ -636,7 +639,7 @@ function createActionHandlers(context) {
|
|
|
636
639
|
await executor.VerifyBrowserWindowUrlContainsExpectedUrl(result.value);
|
|
637
640
|
}),
|
|
638
641
|
VerifyCheckBoxIsNotSelected: withExecutor(async (executor, result) => {
|
|
639
|
-
await executor.VerifyCheckBoxIsNotSelected(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
642
|
+
await executor.VerifyCheckBoxIsNotSelected(result.pageDOM, result.selector, result.value, result.fireflinkIndex, result.elementName, result.elementType);
|
|
640
643
|
}),
|
|
641
644
|
VerifyCheckBoxIsSelected: withExecutor(async (executor, result) => {
|
|
642
645
|
await executor.VerifyCheckBoxIsSelected(result.pageDOM, result.selector, result.fireflinkIndex, result.elementName, result.elementType);
|
|
@@ -14,7 +14,7 @@ class ExecutionContext {
|
|
|
14
14
|
this.session = new initiateBrowserSession_js_1.BrowserSession(browserType_js_1.browsers[request.browser.browserName], request.isCloud, request.capabilities, defaultValues_js_1.DEFAULT_PAGE_LOAD, request.cloudConfig);
|
|
15
15
|
this.locator = new getListOfLocators_js_1.ElementGetter();
|
|
16
16
|
this.scriptAppender = new scriptGenrationData_js_1.ScriptDataAppender();
|
|
17
|
-
this.androidSession = new initiateMobileSession_js_1.MobileSession(request.appiumPort, request.isCloud, request.capabilities, request.cloudConfig);
|
|
17
|
+
this.androidSession = new initiateMobileSession_js_1.MobileSession(request.appiumPort, request.isCloud, request.capabilities, request.cloudConfig, request.adbPath);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.ExecutionContext = ExecutionContext;
|
|
@@ -95,7 +95,7 @@ class AutomationRunner {
|
|
|
95
95
|
const aiInfo = (0, getInstancesInfo_js_1.getAiInstanceInfo)(instanceDetails.responseObject);
|
|
96
96
|
const context = new executionContext_js_1.ExecutionContext(request);
|
|
97
97
|
const configProvider = new llmConfiguration_js_1.ServiceProviderBaseUrlProvider();
|
|
98
|
-
const baseUrl = configProvider.getBaseUrl(aiInfo
|
|
98
|
+
const baseUrl = configProvider.getBaseUrl(aiInfo);
|
|
99
99
|
let domInfo = null;
|
|
100
100
|
let extractedRelevantDom = null;
|
|
101
101
|
let errorInfo = {};
|
|
@@ -330,26 +330,6 @@ class AutomationRunner {
|
|
|
330
330
|
continue;
|
|
331
331
|
}
|
|
332
332
|
try {
|
|
333
|
-
fireflinkIndex = stepResult.response.attribute_value;
|
|
334
|
-
if (fireflinkIndex == "Fire-Flink-0") {
|
|
335
|
-
logData_js_1.logger.error(`element not found for step "${step}"`);
|
|
336
|
-
throw new Error(`element not found for step "${step}"`, { cause: node_console_1.error });
|
|
337
|
-
}
|
|
338
|
-
if (platform === "web") {
|
|
339
|
-
const ele = doc.querySelector(`[ff-inspect="${fireflinkIndex}"]`);
|
|
340
|
-
selector = ele.getAttribute("ff-xpath");
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
const result = await (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, fireflinkIndex);
|
|
344
|
-
selector = result.xpathPath;
|
|
345
|
-
}
|
|
346
|
-
if (!selector) {
|
|
347
|
-
logData_js_1.logger.info(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
348
|
-
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`, { cause: node_console_1.error });
|
|
349
|
-
}
|
|
350
|
-
if (platform === "web") {
|
|
351
|
-
beforeHandles = await driver.getWindowHandles();
|
|
352
|
-
}
|
|
353
333
|
if (stepAction == "Builtin_DragAndDropToElement") {
|
|
354
334
|
handler = actionHandlers[stepAction];
|
|
355
335
|
const fireflinkIndex1 = stepResult.response.drag;
|
|
@@ -377,6 +357,26 @@ class AutomationRunner {
|
|
|
377
357
|
});
|
|
378
358
|
continue;
|
|
379
359
|
}
|
|
360
|
+
fireflinkIndex = stepResult.response.attribute_value;
|
|
361
|
+
if (fireflinkIndex == "Fire-Flink-0") {
|
|
362
|
+
logData_js_1.logger.error(`element not found for step "${step}"`);
|
|
363
|
+
throw new Error(`element not found for step "${step}"`, { cause: node_console_1.error });
|
|
364
|
+
}
|
|
365
|
+
if (platform === "web") {
|
|
366
|
+
const ele = doc.querySelector(`[ff-inspect="${fireflinkIndex}"]`);
|
|
367
|
+
selector = ele.getAttribute("ff-xpath");
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
const result = await (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, fireflinkIndex);
|
|
371
|
+
selector = result.xpathPath;
|
|
372
|
+
}
|
|
373
|
+
if (!selector) {
|
|
374
|
+
logData_js_1.logger.info(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
375
|
+
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`, { cause: node_console_1.error });
|
|
376
|
+
}
|
|
377
|
+
if (platform === "web") {
|
|
378
|
+
beforeHandles = await driver.getWindowHandles();
|
|
379
|
+
}
|
|
380
380
|
if (selector.includes("shadow")) {
|
|
381
381
|
stepAction = stepAction + "_shadow";
|
|
382
382
|
logData_js_1.logger.info(stepAction);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.annotateScreenshot = annotateScreenshot;
|
|
4
|
-
const canvas_1 = require("canvas");
|
|
4
|
+
const canvas_1 = require("@napi-rs/canvas");
|
|
5
5
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
6
6
|
const logData_js_1 = require("../utils/logger/logData.js");
|
|
7
7
|
function parseBounds(bounds) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IServiceProviderBaseUrlConfiguration } from "../core/interfaces/llmConfigurationInterface.js";
|
|
2
2
|
export declare class ServiceProviderBaseUrlProvider implements IServiceProviderBaseUrlConfiguration {
|
|
3
|
-
|
|
4
|
-
getBaseUrl(provider: string): string;
|
|
3
|
+
getBaseUrl(aiInfo: Record<string, string>): string;
|
|
5
4
|
}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ServiceProviderBaseUrlProvider = void 0;
|
|
4
|
+
const BASE_URLS = {
|
|
5
|
+
Groq: "https://api.groq.com/openai/v1",
|
|
6
|
+
DefaultFireFlink: "https://api.groq.com/openai/v1",
|
|
7
|
+
OpenAi: "https://api.openai.com/v1",
|
|
8
|
+
Anthropic: "https://api.anthropic.com/v1/",
|
|
9
|
+
Gemini: "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
10
|
+
};
|
|
4
11
|
class ServiceProviderBaseUrlProvider {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Anthropic: "https://api.anthropic.com/v1/",
|
|
11
|
-
Gemini: "https://generativelanguage.googleapis.com/v1beta/openai/"
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
getBaseUrl(provider) {
|
|
15
|
-
const url = this.baseUrls[provider];
|
|
16
|
-
if (!url) {
|
|
17
|
-
throw new Error(`Unsupported service provider: ${provider}`);
|
|
12
|
+
getBaseUrl(aiInfo) {
|
|
13
|
+
if (aiInfo.serviceProvider === "Azure") {
|
|
14
|
+
if (!aiInfo.resource)
|
|
15
|
+
throw new Error("Resource not found");
|
|
16
|
+
return `https://${aiInfo.resource}.openai.azure.com/openai/v1/`;
|
|
18
17
|
}
|
|
18
|
+
const url = BASE_URLS[aiInfo.serviceProvider];
|
|
19
|
+
if (!url)
|
|
20
|
+
throw new Error(`Unsupported service provider: ${aiInfo.serviceProvider}`);
|
|
19
21
|
return url;
|
|
20
22
|
}
|
|
21
23
|
}
|
package/dist/tests/test1.d.ts
CHANGED
package/dist/tests/test1.js
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const openai_1 = __importDefault(require("openai"));
|
|
7
|
+
const endpoint = "ai4automation";
|
|
8
|
+
const deploymentName = "gpt-4.1-mini";
|
|
9
|
+
const client = new openai_1.default({
|
|
10
|
+
apiKey: "DCcGR0NEoopbPaszZ93cj0v14hVcPqSY3dkuwtOXMA2XxtiCWBqwJQQJ99CDACYeBjFXJ3w3AAABACOGrIjB", // use env variable
|
|
11
|
+
baseURL: `https://${endpoint}.openai.azure.com/openai/v1/`,
|
|
12
|
+
});
|
|
13
|
+
async function run() {
|
|
14
|
+
try {
|
|
15
|
+
const completion = await client.chat.completions.create({
|
|
16
|
+
model: deploymentName,
|
|
17
|
+
messages: [
|
|
18
|
+
{
|
|
19
|
+
role: "user",
|
|
20
|
+
content: "What is the capital of France?",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
console.log(completion.choices[0].message.content);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.error("Error:", err.message);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
run();
|
package/dist/tests/test12.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/tests/test12.js
CHANGED
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
2
|
+
// console.log(new Date().getTime())
|
|
3
|
+
// import { AutomationRunner } from "../index.js"
|
|
4
|
+
// import path from "path";
|
|
5
|
+
// import fs from "fs";
|
|
6
|
+
// const certPath = path.join("D:", "Bitbucket", "automationV2", "Certificates", "certificate.crt");
|
|
7
|
+
// const ssl = {
|
|
8
|
+
// ca: [fs.readFileSync(certPath, "utf-8")],
|
|
9
|
+
// rejectUnauthorized: false,
|
|
10
|
+
// }
|
|
11
|
+
// const runner = new AutomationRunner();
|
|
12
|
+
// runner.run({
|
|
13
|
+
// serviceAccounts: "",
|
|
14
|
+
// topic: "TEst",
|
|
15
|
+
// userStory:
|
|
16
|
+
// [
|
|
17
|
+
// ["Open browser"],
|
|
18
|
+
// ["Maximize the browser"],
|
|
19
|
+
// ["Navigate to https://www.saucedemo.com/"],
|
|
20
|
+
// ["enter standard_user as username"],
|
|
21
|
+
// ["enter secret_sauce as password"],
|
|
22
|
+
// ["click on Login button"],
|
|
23
|
+
// ["Close browser"],
|
|
24
|
+
// ],
|
|
25
|
+
// platform: "web",
|
|
26
|
+
// pageDetails: {
|
|
27
|
+
// Web: {
|
|
28
|
+
// pageId: "PAG73a7a0ad-c092-4351-8a93-68647f60e343",
|
|
29
|
+
// pageName: "ai-Page"
|
|
30
|
+
// }
|
|
31
|
+
// },
|
|
32
|
+
// sessionPath: path.join("D:", "Bitbucket", "automationV2"),
|
|
33
|
+
// serverHost: "https://test3.fireflink.com",
|
|
34
|
+
// webSocketId: "",
|
|
35
|
+
// generatedBy: "",
|
|
36
|
+
// licenseType: "C-Professional",
|
|
37
|
+
// licenseId: "LIC3985",
|
|
38
|
+
// userId: "USR26935",
|
|
39
|
+
// projectType: "Web",
|
|
40
|
+
// browser: {
|
|
41
|
+
// browserName: "Google Chrome",
|
|
42
|
+
// },
|
|
43
|
+
// // broker: ["test3.fireflink.com:9092"],
|
|
44
|
+
// // sslConfig: ssl,
|
|
45
|
+
// // env: "test3",
|
|
46
|
+
// version: "asdfg",
|
|
47
|
+
// type: "sdfg",
|
|
48
|
+
// scriptName: "url",
|
|
49
|
+
// scriptType: "web",
|
|
50
|
+
// projectId: "PJT1116",
|
|
51
|
+
// testCaseId: "SCR1208",
|
|
52
|
+
// promptId: "3f6e123c-8ec6-47c1-90e1-1a2f53b49251",
|
|
53
|
+
// userName: "default-user",
|
|
54
|
+
// appiumPort: 0,
|
|
55
|
+
// platformVersion: "",
|
|
56
|
+
// realDeviceId: "",
|
|
57
|
+
// serverData: "",
|
|
58
|
+
// isCloud: false,
|
|
59
|
+
// cloudConfig: {
|
|
60
|
+
// // accessKey: "yfAa_w199cJge2Gezsgb2Jnu7hKdqER1tExY5kKvgSvXfi1lRUelFsbTFI5pMq7zQuwwNXXnsLTkjKhvWcKDWsUoGLi9KjUV6gbUNDhqj0jWYFyW9h_0LIDEg5qXigwZdqzQqAvWwHin3gBhzGndeROtixv_VFhnseGSWRAHTajZzE-Zl0d8BP6gl0TEBUfoNgqBtAQVDLP6wAQzPfcyjjGFsdHkXWeHFkKmA78D7rKlnNuN2WgjIUlhYheDRDeqZ98Ig_PyS1GbUvjwJ73L38sr_cD4Y9lrKyWJV-m5RmtKhmkqRM8uk5gEfjzgwy30",
|
|
61
|
+
// hostname: "d900-2409-40f2-2165-b548-215a-4429-f3ac-107f.ngrok-free.app",
|
|
62
|
+
// // licenseId: "LIC2026658",
|
|
63
|
+
// // projectName: "Project-6",
|
|
64
|
+
// protocol: "https",
|
|
65
|
+
// path: "wd/hub"
|
|
66
|
+
// },
|
|
67
|
+
// capabilities: {
|
|
68
|
+
// browserName: "MicrosoftEdge",
|
|
69
|
+
// // platformName: "Windows 11",
|
|
70
|
+
// // browserVersion: "146"
|
|
71
|
+
// },
|
|
72
|
+
// isTerminate: false,
|
|
73
|
+
// token: "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJRUFRfTnFuMkxxdDVmN09tOElWaW53dUJlR3ZVUUVBUkdxZkFuRHJxZU9NIn0.eyJleHAiOjE3NzY0MjU3ODQsImlhdCI6MTc3NjMzOTM4NCwianRpIjoib25ydHJvOmY1ZGE1NDljLWIwOWEtNDgyZi1hYmRiLWJlOGYzMGZmZjMxYyIsImlzcyI6Imh0dHA6Ly8xMDMuMTgyLjIxMC4yMjY6MzAxMDcvcmVhbG1zL0ZpcmVGbGluay10ZXN0MyIsImF1ZCI6InRhcmdldC1jbGllbnQiLCJzdWIiOiJmOmNhMzBmNDk3LTY1Y2YtNGU4Zi1iZGE3LTE0ZjM1NTNiYzZmNTpqYWlha2FzaEB5b3BtYWlsLmNvbSIsInR5cCI6IkJlYXJlciIsImF6cCI6ImZsaW5rLXNlcnZpY2UiLCJzaWQiOiI2MzkyMWU2My03MGJlLTQ1MTgtYWU5MS1hZjk3Y2Y2ZDE0ZDIiLCJhY3IiOiIxIiwiYWxsb3dlZC1vcmlnaW5zIjpbIioiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInNjb3BlIjoiZW1haWwgcHJvZmlsZSIsImN1cnJlbnRMaWNlbnNlSWQiOiJMSUMzOTg1IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJjdXJyZW50UHJpdmlsZWdlIjoiU3VwZXIgQWRtaW4iLCJmdWxsTmFtZSI6ImphaSIsImFjdGl2YXRpb25TdGF0dXMiOiJBQ1RJVkUiLCJwcml2aWxlZ2UiOiJTdXBlciBBZG1pbiIsImxpY2Vuc2VOYW1lIjoiRmlyZUZsaW5rIC0gTElDMzk4NSIsInByZWZlcnJlZF91c2VybmFtZSI6ImphaSIsInVzZXJOYW1lIjoiamFpYWthc2hAeW9wbWFpbC5jb20iLCJiaWxsaW5nQ3ljbGUiOiJRdWFydGVybHkiLCJpZCI6IlVTUjI2OTM1IiwibGljZW5zZUlkIjoiTElDMzk4NSIsImVtYWlsIjoiamFpYWthc2hAeW9wbWFpbC5jb20ifQ.eO4c1JoekBHymCU7OpxdVVZhKysFdH5kLbb7HveZk7HyzaS4Bjc1fdmMBu-BuvUvxHUdWYlRZP_9Zc8LKHsqe0uF_qwTddT7QDWnnS0TgFHLHCIcd_uQ1KHrfPGvEyaxpylrbke9KOWG66N37h1JaBfyT-b5P_CxKn5K_MsSpJH3U8ceDk8F1cKoz_L_ArM1rPMAsJxCAANf3PJfTt8F4qlgxEW6CoqY1W-qba_Dw8PztU3uL0ERrIT0ZDI8u1Nj9LaN_j9NDruu2kB_KNa2n_pcFqq2hvu8Ac1dF5t6n_sU5TXElYSO5FOkLXRgkYpX4ClZuqDU8Oza1PaYxLGuLw"
|
|
74
|
+
// })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fireflinkKafka_service_js_1 = require("../service/kafka/fireflinkKafka.service.js");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const certPath = path_1.default.join("D:", "Bitbucket", "automationV2", "Certificates", "certificate.crt");
|
|
10
|
+
const ssl = {
|
|
11
|
+
ca: [fs_1.default.readFileSync(certPath, "utf-8")],
|
|
12
|
+
rejectUnauthorized: false,
|
|
13
|
+
};
|
|
14
|
+
const inst = new fireflinkKafka_service_js_1.KafkaProducerService(["test.fireflink.com:9222"], ssl);
|
|
15
|
+
let payload = {
|
|
16
|
+
topic: `Topic-FIREFLINK-api-requests-test3`,
|
|
17
|
+
message: {
|
|
18
|
+
"stepData": [{
|
|
19
|
+
"nlpName": "OpenBrowser",
|
|
20
|
+
"elementsData": [],
|
|
21
|
+
"stepInputs": []
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"type": "web",
|
|
25
|
+
"scriptName": "NLPList6",
|
|
26
|
+
"version": "",
|
|
27
|
+
"scriptType": "Web & Mobile (Android & iOS)",
|
|
28
|
+
"projectId": "PJT1041",
|
|
29
|
+
"testCaseId": "SCR1930",
|
|
30
|
+
"promptId": "1f348fb3-b0f6-4eb4-b9a0-6c6cc33fea68",
|
|
31
|
+
"pageDetails": {
|
|
32
|
+
"Web": {
|
|
33
|
+
"pageId": "PAG025b6c68-9a55-46da-b353-0894f29c7f27",
|
|
34
|
+
"pageName": "ai-Page"
|
|
35
|
+
},
|
|
36
|
+
"Android": {
|
|
37
|
+
"pageId": "PAGb830f55d-077a-4d09-ae71-91fece6b0011",
|
|
38
|
+
"pageName": "ai-Android-Page"
|
|
39
|
+
},
|
|
40
|
+
"iOS": {
|
|
41
|
+
"pageId": "PAGcbb751fe-f056-4a09-a2ba-64c1092b5f89",
|
|
42
|
+
"pageName": "ai-Ios-Page"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"generatedBy": "",
|
|
46
|
+
"webSocketId": "",
|
|
47
|
+
"licenseType": "C-Professional",
|
|
48
|
+
"licenseId": "LIC3916",
|
|
49
|
+
"userId": "USR26696",
|
|
50
|
+
"projectType": "Web & Mobile",
|
|
51
|
+
"topic": "Topic-FIREFLINK-api-requests-performances",
|
|
52
|
+
"serverHost": "https://performances.fireflink.com",
|
|
53
|
+
"tokensConsumed": 1234,
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
inst.produceMessage(payload);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const webdriverio_1 = require("webdriverio");
|
|
4
|
+
(async () => {
|
|
5
|
+
const browser = await (0, webdriverio_1.remote)({
|
|
6
|
+
automationProtocol: 'webdriver',
|
|
7
|
+
capabilities: {
|
|
8
|
+
browserName: 'chrome',
|
|
9
|
+
'goog:chromeOptions': {
|
|
10
|
+
debuggerAddress: '127.0.0.1:9222'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
// Use existing Chrome session
|
|
15
|
+
const url = await browser.getUrl();
|
|
16
|
+
console.log('Current URL:', url);
|
|
17
|
+
// Navigate somewhere
|
|
18
|
+
await browser.url('https://www.google.com');
|
|
19
|
+
// Example action
|
|
20
|
+
const title = await browser.getTitle();
|
|
21
|
+
console.log('Page Title:', title);
|
|
22
|
+
// Don't close Chrome (important)
|
|
23
|
+
await browser.deleteSession();
|
|
24
|
+
})();
|
|
@@ -2,4 +2,4 @@ export interface AnnotatedDOMResult {
|
|
|
2
2
|
dom: string;
|
|
3
3
|
}
|
|
4
4
|
export declare function getAnnotatedDOM(browser: WebdriverIO.Browser): Promise<AnnotatedDOMResult>;
|
|
5
|
-
export declare function getAnnotatedDOMForMobile(driver: WebdriverIO.Browser): Promise<AnnotatedDOMResult>;
|
|
5
|
+
export declare function getAnnotatedDOMForMobile(driver: WebdriverIO.Browser, existingDom?: string): Promise<AnnotatedDOMResult>;
|
|
@@ -222,17 +222,21 @@ async function getAnnotatedDOM(browser) {
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
const xmldom_1 = require("@xmldom/xmldom");
|
|
225
|
-
async function getAnnotatedDOMForMobile(driver) {
|
|
225
|
+
async function getAnnotatedDOMForMobile(driver, existingDom) {
|
|
226
226
|
try {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
let pageSource = "";
|
|
228
|
+
if (existingDom) {
|
|
229
|
+
pageSource = existingDom;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
await driver.pause(1000);
|
|
233
|
+
const startTime = Date.now();
|
|
234
|
+
pageSource = await driver.getPageSource();
|
|
235
|
+
logData_js_1.logger.info(`Page source captured in ${Date.now() - startTime}ms`);
|
|
236
|
+
}
|
|
232
237
|
if (!pageSource) {
|
|
233
238
|
throw new Error("Unable to capture DOM");
|
|
234
239
|
}
|
|
235
|
-
// Parse XML DOM
|
|
236
240
|
const parser = new xmldom_1.DOMParser();
|
|
237
241
|
const xmlDoc = parser.parseFromString(pageSource, "text/xml");
|
|
238
242
|
const allElements = xmlDoc.getElementsByTagName("*");
|
|
@@ -6,7 +6,8 @@ function getAiInstanceInfo(responseObject) {
|
|
|
6
6
|
serviceProvider: responseObject.serviceProvider,
|
|
7
7
|
apiKey: responseObject.instanceDetails.apiKey,
|
|
8
8
|
apiUrl: responseObject.instanceDetails.apiUrl,
|
|
9
|
-
visionApiKey: responseObject
|
|
9
|
+
visionApiKey: responseObject?.instanceDetails?.visionApiKey,
|
|
10
10
|
model: responseObject.model,
|
|
11
|
+
resource: responseObject.resource ?? null,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function findElementInDom(driver: WebdriverIO.Browser, text: string): Promise<{
|
|
1
|
+
export declare function findElementInDom(driver: WebdriverIO.Browser, text: string, stepCount: number, rawdom: string): Promise<{
|
|
2
2
|
element: import("webdriverio").ChainablePromiseElement;
|
|
3
3
|
xpath: string;
|
|
4
4
|
annotatedDom: string;
|