Debugging with JS

Pre requirements

Debugging

1- Get your latest Code on Javascript Branch and Open it with VS Code.

 

2- Set Local Settings in local-driver.js File

const host = '127.0.0.1'; //Appium Server IP/Host const port = 4723; // Appium Server port const udid = '51007d22b49g45e5'; // Mobile Device UDID const app = '/Users/myUser/Documents/myApp.apk'; //APK or IPA file path const deviceOs = 'android'; // android or ios const platformVersion = '10.0'; // device platform version const deviceName = '51007d22b49f45e5'; // Mobile Device Name const customCaps = '{"screenshotQuality":"2","usePrebuiltWDA":"true","useNewWDA":"false","fullReset":"true","noReset":"false","autoGrantPermissions":"true"}'; //capabilities

Screenshots saved to this folder on your computer

var screenShotCasePath = '/Users/myUser/Documents/screenshots'; // FullPath of your screenshot files

3- Set Appium Capabilities in appium.config.js File

... fullReset: true, // appium capability noReset: false, // appium capability newCommandTimeout: 340000, // appium capability

 

4- Start Appium Server

Make sure your JAVA_HOME and ANDROID_HOME environment variables already set before for Android.

Click Start Server on your Appium Desktop Client App. Or run it from terminal / command line with this command.

Appium &

 

5- Run your Test

Open Terminal window on VS Code and navigate to your TestCase folder. Run the following command.

mocha myTestCase.js

6- Check your Test Results, screenshots, logs

  • {screenShotCasePath}/Step_MyStep_Before.png

  • {screenShotCasePath}/Step_MyStep_After.png