Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix help messages for iOS errors. #4189

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
10 changes: 5 additions & 5 deletions lib/utils/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class RealIosDeviceIdError extends Error {
`Pass ${Logger.colors.green('deviceId')} in the command (for e.g : ${Logger.colors.cyan('--deviceId 00008030-00024C2C3453402E')})`,
`Or pass ${Logger.colors.green('safari:deviceUDID')} capability in config`,
`To verify the deviceId run, ${Logger.colors.cyan('system_profiler SPUSBDataType | sed -n \'/iPhone/,/Serial/p\' | grep \'Serial Number:\' | awk -F \': \' \'{print $2}')}`,
`For more help, run: ${Logger.colors.cyan('npx run @nightwatch/mobile-helper ios')}\n`
`For more help, run: ${Logger.colors.cyan('npx @nightwatch/mobile-helper ios')}\n`
];
this.stack = false;
}
Expand Down Expand Up @@ -275,7 +275,7 @@ class IosSessionNotCreatedError extends Error {
// 'The session timed out while connecting to a Safari instance.'
help = [
'Re-run the test command',
`If it doesn't work, try running: ${Logger.colors.cyan('npx run @nightwatch/mobile-helper ios')}`
`If it doesn't work, try running: ${Logger.colors.cyan('npx @nightwatch/mobile-helper ios')}`
];
} else if (this.message.includes('not find any session hosts') || this.message.includes('Some devices were found')) {
// Could not find any session hosts that match the requested capabilities
Expand All @@ -284,21 +284,21 @@ class IosSessionNotCreatedError extends Error {
help = [
`Run command to get device list: ${Logger.colors.cyan('xcrun simctl list devices')}`,
`Update the ${Logger.colors.cyan('safari:platformVersion')} and/or ${Logger.colors.cyan('safari:platforName')} in Nightwatch configuration accordingly`,
`If it doesn't work, try running: ${Logger.colors.cyan('npx run @nightwatch/mobile-helper ios')}`
`If it doesn't work, try running: ${Logger.colors.cyan('npx @nightwatch/mobile-helper ios')}`
];
} else {
help = [
`Make sure you have passed correct ${Logger.colors.green('deviceId')} in the command (for e.g : ${Logger.colors.cyan('--deviceId 00008030-00024C2C3453402E')})`,
`Or pass ${Logger.colors.green('safari:deviceUDID')} capability in config`,
`To verify the deviceId run, ${Logger.colors.cyan('system_profiler SPUSBDataType | sed -n \'/iPhone/,/Serial/p\' | grep \'Serial Number:\' | awk -F \': \' \'{print $2}')}`,
`For more help, run: ${Logger.colors.cyan('npx run @nightwatch/mobile-helper ios')}\n`
`For more help, run: ${Logger.colors.cyan('npx @nightwatch/mobile-helper ios')}\n`
];
}
} else if (this.desiredCapabilities['safari:deviceUDID']) {
help = [
`Verify the UDID of the device set in Nightwatch configuration (look for ${Logger.colors.cyan('safari:deviceUDID')} capability) or pass the correct UDID using ${Logger.colors.cyan('--deviceId')} flag in the test command.`,
'Re-run the test command',
`If it doesn't work, try running: ${Logger.colors.cyan('npx run @nightwatch/mobile-helper ios')}`
`If it doesn't work, try running: ${Logger.colors.cyan('npx @nightwatch/mobile-helper ios')}`
];

if (isRealIos(this.desiredCapabilities)) {
Expand Down
Loading