Skip to content

Commit

Permalink
Fix connect info for mobile app testing. (nightwatchjs#3577)
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 authored and harshit-bs committed Mar 16, 2023
1 parent 9cd9735 commit 370c1ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/transport/selenium-webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/transport/selenium-webdriver/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -38,7 +39,8 @@ module.exports = class Session {
platform,
platformVersion,
browserName,
browserVersion
browserVersion,
appId
},
capabilities: Session.serializeCapabilities(sessionCapabilities)
};
Expand Down

0 comments on commit 370c1ec

Please sign in to comment.