The current UIA2 driver does not uninstall UIA2 servers on the device if they are newer than newly installed servers by the UIA2. It could cause old UIA2 driver with newer UIA2 servers on the device, which is a mismatch condition. It could cause unexpected behavior.
Maybe... this.adb.APP_INSTALL_STATE.NOT_INSTALLED condition should be this.adb.APP_INSTALL_STATE.NEWER_VERSION_INSTALLED to "uninstall" installed UIA2 servers?
It looks like sinon mock's expects, never, once etc might not be so reliable. Some could be not good. To improve condition check as test code, I have extracted condition check into two methods and added tests for them. At least shouldUninstallServerPackages and canInstallServerPackages tests should be reliable.
https://github.com/appium/appium/issues/19799#issuecomment-2181932720
The current UIA2 driver does not uninstall UIA2 servers on the device if they are newer than newly installed servers by the UIA2. It could cause old UIA2 driver with newer UIA2 servers on the device, which is a mismatch condition. It could cause unexpected behavior. Maybe...
this.adb.APP_INSTALL_STATE.NOT_INSTALLED
condition should bethis.adb.APP_INSTALL_STATE.NEWER_VERSION_INSTALLED
to "uninstall" installed UIA2 servers?It looks like
sinon
mock'sexpects
,never
, once etc might not be so reliable. Some could be not good. To improve condition check as test code, I have extracted condition check into two methods and added tests for them. At leastshouldUninstallServerPackages
andcanInstallServerPackages
tests should be reliable.