Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# List things here that *are - 'used, that depcheck is wrong about'

ignores:
- '@metamask/oss-attribution-generator'
- '@metamask/test-dapp-multichain'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-release-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
pull-requests: write
steps:
- name: Update Release Changelog
uses: MetaMask/github-tools/.github/actions/update-release-changelog@v1.1.0
uses: MetaMask/github-tools/.github/actions/update-release-changelog@v1.1.2
with:
release-branch: ${{ github.ref_name }}
repository-url: ${{ github.server_url }}/${{ github.repository }}
platform: mobile
previous-version-ref: 'null'
github-tools-version: v1.1.0
github-tools-version: v1.1.2
github-token: ${{ secrets.PR_TOKEN }}
245 changes: 109 additions & 136 deletions .yarn/patches/appwright-npm-0.1.45-f282bc1c1b.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,107 @@ index a51913b3f9380fd5740b1d52cd1d3472e29233c3..6479c9b92ed17319f654e9323f689792
reporter: [["list"], ["html", { open: "always" }]],
use: {
// TODO: Use this for actions
diff --git a/dist/device/index.js b/dist/device/index.js
index fda54b682837d06eb579596087826c862c35f33e..b61aceca45b8b3293dee14552c26f002b38a4e36 100644
--- a/dist/device/index.js
+++ b/dist/device/index.js
@@ -237,7 +237,7 @@ let Device = (() => {
findStrategy: isAndroid
? "-android uiautomator"
: "-ios predicate string",
- textToMatch: text,
+ textToMatch: null,
});
}
/**
diff --git a/dist/locator/index.js b/dist/locator/index.js
index 03f00574615d647d1887440ee7ae10798934c250..40089ce61ad598625afeb42d1149da8ce007dc26 100644
--- a/dist/locator/index.js
+++ b/dist/locator/index.js
@@ -244,51 +244,33 @@ let Locator = (() => {
]);
}
}
- /**
- * Retrieves the element reference based on the `selector`.
- *
- * @returns
- */
+
async getElement() {
- /**
- * Determine whether `path` is a regex or string, and find elements accordingly.
- *
- * If `path` is a regex:
- * - Iterate through all the elements on the page
- * - Extract text content of each element
- * - Return the first matching element
- *
- * If `path` is a string:
- * - Use `findStrategy` (either XPath, Android UIAutomator, or iOS predicate string) to find elements
- * - Apply regex to clean extra characters from the matched element’s text
- * - Return the first element that matches
- */
- let elements = await this.webDriverClient.findElements(this.findStrategy, this.selector);
- // If there is only one element, return it
- if (elements.length === 1) {
- return elements[0];
- }
- // If there are multiple elements, we reverse the order since the probability
- // of finding the element is higher at higher depth
+ const elements = await this.webDriverClient.findElements(this.findStrategy, this.selector);
const reversedElements = elements.reverse();
+ console.log('Reversed elements length', reversedElements.length);
+ // If no text matching is needed, just return the first (deepest) element
+ if (!this.textToMatch) {
+ console.log('No text to match, returning first element');
+ return reversedElements[0] || null;
+ }
+
+ // Only iterate and fetch text if we need to match text
for (const element of reversedElements) {
let elementText = await this.webDriverClient.getElementText(element["element-6066-11e4-a52e-4f735466cecf"]);
- if (this.textToMatch) {
- if (this.textToMatch instanceof RegExp &&
- this.textToMatch.test(elementText)) {
- return element;
- }
- if (typeof this.textToMatch === "string" &&
- elementText.includes(this.textToMatch)) {
- return element;
- }
+ console.log('Element text', elementText);
+ console.log('Text to match', this.textToMatch);
+
+ if (this.textToMatch instanceof RegExp &&
+ this.textToMatch.test(elementText)) {
+ return element;
}
- else {
- // This is returned for cases where xpath is findStrategy and we want
- // to return the last element found in the list
+ if (typeof this.textToMatch === "string" &&
+ elementText.includes(this.textToMatch)) {
return element;
}
}
+
return null;
}
};
diff --git a/dist/providers/browserstack/index.js b/dist/providers/browserstack/index.js
index 638c5df686413ffe050ef7e7329b9e9446e98002..61ecd1508400f59302d6139a805e7a912e9a1036 100644
index 638c5df686413ffe050ef7e7329b9e9446e98002..34e211940e22cc195002e6d88a98d7b8488d88d0 100644
--- a/dist/providers/browserstack/index.js
+++ b/dist/providers/browserstack/index.js
@@ -120,6 +120,12 @@ class BrowserStackDeviceProvider {
@@ -104,6 +104,7 @@ class BrowserStackDeviceProvider {
async createDriver(config) {
const WebDriver = (await import("webdriver")).default;
const webDriverClient = await WebDriver.newSession(config);
+
this.sessionId = webDriverClient.sessionId;
const bundleId = await this.getAppBundleIdFromSession();
const testOptions = {
@@ -120,6 +121,12 @@ class BrowserStackDeviceProvider {
return this.sessionDetails?.app_details.app_name ?? "";
}
static async downloadVideo(sessionId, outputDir, fileName) {
Expand All @@ -30,7 +126,7 @@ index 638c5df686413ffe050ef7e7329b9e9446e98002..61ecd1508400f59302d6139a805e7a91
const sessionData = await getSessionDetails(sessionId);
const sessionDetails = sessionData?.automation_session;
const videoURL = sessionDetails?.video_url;
@@ -241,7 +247,10 @@ class BrowserStackDeviceProvider {
@@ -241,7 +248,10 @@ class BrowserStackDeviceProvider {
capabilities: {
"bstack:options": {
debug: true,
Expand All @@ -41,7 +137,7 @@ index 638c5df686413ffe050ef7e7329b9e9446e98002..61ecd1508400f59302d6139a805e7a91
networkLogs: true,
appiumVersion: "2.6.0",
enableCameraImageInjection: this.project.use.device?.enableCameraImageInjection,
@@ -250,10 +259,10 @@ class BrowserStackDeviceProvider {
@@ -250,10 +260,10 @@ class BrowserStackDeviceProvider {
osVersion: this.project.use.device.osVersion,
platformName: platformName,
deviceOrientation: this.project.use.device?.orientation,
Expand All @@ -54,144 +150,21 @@ index 638c5df686413ffe050ef7e7329b9e9446e98002..61ecd1508400f59302d6139a805e7a91
: process.env.USER,
},
"appium:autoGrantPermissions": true,
@@ -261,6 +270,11 @@ class BrowserStackDeviceProvider {
@@ -261,6 +271,17 @@ class BrowserStackDeviceProvider {
"appium:autoAcceptAlerts": true,
"appium:fullReset": true,
"appium:settings[snapshotMaxDepth]": 62,
+ "appium:settings[autoGrantPermissions]": true,
+ "appium:settings[waitForIdleTimeout]": 10000,
+ "appium:settings[waitForIdleTimeout]": 2000,
+ "appium:settings[actionAcknowledgmentTimeout]": 3000,
+ "appium:settings[ignoreUnimportantViews]": true,
+ "appium:settings[waitForSelectorTimeout]": 10000,
+ "appium:settings[waitForSelectorTimeout]": 1000,
+ "appium:bstackPageSource": {
+ "enable": true,
+ "samplesX": 15,
+ "samplesY": 15,
+ "maxDepth": 75
+ }
},
};
}
diff --git a/dist/reporter.js b/dist/reporter.js
index 516da403677d49af5fbb18edaf9f308dad401e55..ae1895be0513e2aa3ada45ad93a3f3c489e42911 100644
--- a/dist/reporter.js
+++ b/dist/reporter.js
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
const providers_1 = require("./providers");
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
-const fluent_ffmpeg_1 = __importDefault(require("fluent-ffmpeg"));
-const ffmpeg_1 = __importDefault(require("@ffmpeg-installer/ffmpeg"));
+// const fluent_ffmpeg_1 = __importDefault(require("fluent-ffmpeg"));
+// const ffmpeg_1 = __importDefault(require("@ffmpeg-installer/ffmpeg"));
const logger_1 = require("./logger");
const utils_1 = require("./utils");
const workerInfo_1 = require("./fixture/workerInfo");
@@ -183,25 +183,32 @@ function trimVideo({ originalVideoPath, startSecs, durationSecs, outputPath, })
fs_1.default.copyFileSync(originalVideoPath, copyFullPath);
return new Promise((resolve, reject) => {
let stdErrs = "";
- (0, fluent_ffmpeg_1.default)(copyFullPath)
- .setFfmpegPath(ffmpeg_1.default.path)
- .setStartTime(startSecs)
- .setDuration(durationSecs)
- .output(fullOutputPath)
- .on("end", () => {
- logger_1.logger.log(`Trimmed video saved at: ${fullOutputPath}`);
- fs_1.default.unlinkSync(copyFullPath);
- resolve(fullOutputPath);
- })
- .on("stderr", (stderrLine) => {
- stdErrs += stderrLine + "\n";
- })
- .on("error", (err) => {
- logger_1.logger.error("ffmpeg error:", err);
- logger_1.logger.error("ffmpeg stderr:", stdErrs);
- reject(err);
- })
- .run();
+ // Video trimming disabled - ffmpeg removed
+ // (0, fluent_ffmpeg_1.default)(copyFullPath)
+ // .setFfmpegPath(ffmpeg_1.default.path)
+ // .setStartTime(startSecs)
+ // .setDuration(durationSecs)
+ // .output(fullOutputPath)
+ // .on("end", () => {
+ // logger_1.logger.log(`Trimmed video saved at: ${fullOutputPath}`);
+ // fs_1.default.unlinkSync(copyFullPath);
+ // resolve(fullOutputPath);
+ // })
+ // .on("stderr", (stderrLine) => {
+ // stdErrs += stderrLine + "\n";
+ // })
+ // .on("error", (err) => {
+ // logger_1.logger.error("ffmpeg error:", err);
+ // logger_1.logger.error("ffmpeg stderr:", stdErrs);
+ // reject(err);
+ // })
+ // .run();
+
+ // Just copy the original video without trimming
+ fs_1.default.copyFileSync(copyFullPath, fullOutputPath);
+ fs_1.default.unlinkSync(copyFullPath);
+ logger_1.logger.log(`Video copied without trimming: ${fullOutputPath}`);
+ resolve(fullOutputPath);
});
}
async function getWorkerStartTime(idx) {
diff --git a/dist/vision/index.js b/dist/vision/index.js
index bf485308fe5ddde81b396bf87dbb365cc37efa0e..8e5f191e6b210c5839257bd6a1879b1f9ce45228 100644
--- a/dist/vision/index.js
+++ b/dist/vision/index.js
@@ -38,8 +38,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VisionProvider = void 0;
-const vision_1 = require("@empiricalrun/llm/vision");
-const point_1 = require("@empiricalrun/llm/vision/point");
+// const vision_1 = require("@empiricalrun/llm/vision");
+// const point_1 = require("@empiricalrun/llm/vision/point");
const fs_1 = __importDefault(require("fs"));
const test_1 = __importDefault(require("@playwright/test"));
const utils_1 = require("../utils");
@@ -64,42 +64,12 @@ let VisionProvider = (() => {
this.webDriverClient = webDriverClient;
}
async query(prompt, options) {
- test_1.default.skip(!process.env.OPENAI_API_KEY, "LLM vision based extract text is not enabled. Set the OPENAI_API_KEY environment variable to enable it");
- let base64Screenshot = options?.screenshot;
- if (!base64Screenshot) {
- base64Screenshot = await this.webDriverClient.takeScreenshot();
- }
- return await (0, vision_1.query)(base64Screenshot, prompt, options);
+ test_1.default.skip(true, "LLM vision based extract text is disabled - @empiricalrun/llm removed");
+ throw new Error("LLM vision functionality has been disabled");
}
async tap(prompt, options) {
- test_1.default.skip(!process.env.EMPIRICAL_API_KEY, "LLM vision based tap is not enabled. Set the EMPIRICAL_API_KEY environment variable to enable it");
- const base64Image = await this.webDriverClient.takeScreenshot();
- const coordinates = await (0, point_1.getCoordinatesFor)(prompt, base64Image, options);
- if (coordinates.annotatedImage) {
- const random = Math.floor(1000 + Math.random() * 9000);
- const file = test_1.default.info().outputPath(`${random}.png`);
- await fs_1.default.promises.writeFile(file, Buffer.from(coordinates.annotatedImage, "base64"));
- await test_1.default.info().attach(`${random}`, { path: file });
- }
- const driverSize = await this.webDriverClient.getWindowRect();
- const { container: imageSize, x, y } = coordinates;
- const scaleFactorWidth = imageSize.width / driverSize.width;
- const scaleFactorHeight = imageSize.height / driverSize.height;
- if (scaleFactorWidth !== scaleFactorHeight) {
- logger_1.logger.warn(`Scale factors are different: ${scaleFactorWidth} vs ${scaleFactorHeight}`);
- }
- const tapTargetX = x / scaleFactorWidth;
- // This uses the width scale factor because getWindowRect on LambdaTest returns a smaller
- // height value than the screenshot height, which causes disproportionate scaling
- // for width and height.
- // For example, Pixel 8 screenshot is 1080 (w) x 2400 (h), but LambdaTest returns
- // 1080 (w) x 2142 (h) for getWindowRect.
- const tapTargetY = y / scaleFactorWidth;
- await this.device.tap({
- x: tapTargetX,
- y: tapTargetY,
- });
- return { x: tapTargetX, y: tapTargetY };
+ test_1.default.skip(true, "LLM vision based tap is disabled - @empiricalrun/llm removed");
+ throw new Error("LLM vision functionality has been disabled");
}
};
})();
26 changes: 26 additions & 0 deletions .yarn/patches/appwright-patch-bd36f2d657.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/dist/providers/browserstack/index.js b/dist/providers/browserstack/index.js
index 61ecd1508400f59302d6139a805e7a912e9a1036..c7772bec15413478dd0d446f7c9f805e16b00851 100644
--- a/dist/providers/browserstack/index.js
+++ b/dist/providers/browserstack/index.js
@@ -104,6 +104,21 @@ class BrowserStackDeviceProvider {
async createDriver(config) {
const WebDriver = (await import("webdriver")).default;
const webDriverClient = await WebDriver.newSession(config);
+ await webDriverClient.updateSettings({
+ waitForIdleTimeout: 100,
+ waitForSelectorTimeout: 0,
+ shouldWaitForQuiescence: false,
+ snapshotMaxDepth: 62,
+ snapshotTimeout: 50000,
+ "appium:settings[snapshotMaxDepth]": 62,
+ "appium:settings[customSnapshotTimeout]": 50000,
+ "appium:bstackPageSource": {
+ "enable": true,
+ "samplesX": 15,
+ "samplesY": 15,
+ "maxDepth": 100
+ }
+ });
this.sessionId = webDriverClient.sessionId;
const bundleId = await this.getAppBundleIdFromSession();
const testOptions = {
Loading
Loading