AppiumTestDistribution / appium-interceptor-plugin

Appium 2.0 plugin to mock api calls for android apps
27 stars 11 forks source link

appium-interceptor test connection script got failed #14

Closed LoveSoni closed 8 months ago

LoveSoni commented 8 months ago

Prerequisites: Appium Version: 2.4.1 Npm Version: 10.2.4 Apple Macbook Intel(i9) Steps to Reproduce a) Install appium inspector plugin appium plugin install --source=npm appium-interceptor

Screenshot 2024-01-08 at 18 59 30

b) Now download ca certificate from here and install it on device

Screenshot 2024-01-08 at 19 01 20

Note: Make sure certificate is trusted c) Now test the connection with following command appium plugin run appium-interceptor test-connection

Screenshot 2024-01-08 at 19 02 43

d) Observe that test connection script is getting failed

sudharsan-selvaraj commented 8 months ago

The test script is not shipped as part of 1.0.0-beta.1. We will publish a new release tomorrow and it should work fine Meanwhile you can start running the test and the mocking should work as expected.

LoveSoni commented 8 months ago

oh ok, i was trying to run my test with the following desired capabilities capabilities.setCapability("appium:platformName", "android"); capabilities.setCapability("appium:app","/.//test_app_mitm_proxy.apk"); capabilities.setCapability("appium:forceAppLaunch", true); capabilities.setCapability("appium:automationName","uiautomator2"); capabilities.setCapability("appium:intercept", true);

but getting following error on appium server Encountered internal error running command: Error: ENOENT: no such file or directory, lstat '/Users/{username}/node_modules/appium-interceptor/certificate'

saikrishna321 commented 8 months ago

@LoveSoni I have published latest version beta.4

Can you try with that version and let us know.

saikrishna321 commented 8 months ago

@LoveSoni Please share full server logs.

LoveSoni commented 8 months ago

appium-server-logs.txt

sudharsan-selvaraj commented 8 months ago

The command name should be interceptor: addMock. There is whitespace after interceptor: keyword.

LoveSoni commented 8 months ago

Thanks @sudharsan-selvaraj, but now when i'm running the script, getting following certificate error on appium server And then the internet stopped working on android device

}
HTTPS_CLIENT_ERROR
[Error: 800B8E5DF87F0000:error:0A000416:SSL routines:ssl3_read_bytes:ssl/tls alert certificate unknown:ssl/record/rec_layer_s3.c:861:SSL alert number 46
] {
  library: 'SSL routines',
  reason: 'ssl/tls alert certificate unknown',
  code: 'ERR_SSL_SSL/TLS_ALERT_CERTIFICATE_UNKNOWN'
}
sudharsan-selvaraj commented 8 months ago

I could be a certificate issue. Trying uninstalling the previous certificate and follow the steps from https://github.com/AppiumTestDistribution/appium-interceptor-plugin/blob/master/docs/certificate-installation.md and give another try.

LoveSoni commented 8 months ago

Thanks @sudharsan-selvaraj, it is working now