From 370c1ecaddc28ac52854c24b4e989d5344475c82 Mon Sep 17 00:00:00 2001 From: Priyansh Garg <39924567+garg3133@users.noreply.github.com> Date: Fri, 20 Jan 2023 01:15:32 +0530 Subject: [PATCH] Fix connect info for mobile app testing. (#3577) --- lib/transport/selenium-webdriver/index.js | 10 ++++++++-- lib/transport/selenium-webdriver/session.js | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/transport/selenium-webdriver/index.js b/lib/transport/selenium-webdriver/index.js index f32c7a13aa..a039c2e3fd 100644 --- a/lib/transport/selenium-webdriver/index.js +++ b/lib/transport/selenium-webdriver/index.js @@ -316,9 +316,15 @@ class Transport extends BaseTransport { } if (this.outputEnabled) { - const {platform, browserVersion, platformVersion, browserName} = sessionInfo; + const {platform, browserVersion, platformVersion, browserName, appId} = sessionInfo; + + const appName = appId.split('.').pop() || browserName; + const appVersion = browserVersion && ` (${browserVersion})`; + const platName = platform.toUpperCase(); + const platVersion = platformVersion && ` (${platformVersion})`; + // eslint-disable-next-line no-console - console.info(` Using: ${colors.light_blue(browserName)} ${colors.brown('(' + (browserVersion) + ')')} on ${colors.cyan(platform.toUpperCase() + (platformVersion ? (' (' + platformVersion + ')') : ''))}.\n`); + console.info(` Using: ${colors.light_blue(appName)}${colors.brown(appVersion)} on ${colors.cyan(platName + platVersion)}.\n`); } } diff --git a/lib/transport/selenium-webdriver/session.js b/lib/transport/selenium-webdriver/session.js index b5273364a5..02d1dab6ed 100644 --- a/lib/transport/selenium-webdriver/session.js +++ b/lib/transport/selenium-webdriver/session.js @@ -27,6 +27,7 @@ module.exports = class Session { const platformVersion = sessionCapabilities.get('platformVersion') || ''; const browserName = sessionCapabilities.getBrowserName(); const browserVersion = sessionCapabilities.getBrowserVersion() || sessionCapabilities.get('version') || ''; + const appId = sessionCapabilities.get('appPackage') || sessionCapabilities.get('bundleId') || ''; const executor = await this.driver.getExecutor(); const elementKey = executor.w3c ? Session.WEB_ELEMENT_ID : 'ELEMENT'; @@ -38,7 +39,8 @@ module.exports = class Session { platform, platformVersion, browserName, - browserVersion + browserVersion, + appId }, capabilities: Session.serializeCapabilities(sessionCapabilities) };