fix(appium): Inject symlinks for all installed extensions#21664
fix(appium): Inject symlinks for all installed extensions#21664mykola-mokhnach merged 4 commits intoappium:masterfrom
Conversation
| // We also inject the symlink into other installed extensions' node_modules folders | ||
| // as these might be cleaned up unexpectedly by npm | ||
| // (see https://github.com/appium/python-client/pull/1177#issuecomment-3419826643). | ||
| await B.all(symlinkInjectionPromises); |
There was a problem hiding this comment.
We can probably use the native Promise.all instead
There was a problem hiding this comment.
both do the same thing. Changed to Promise
KazuCocoa
left a comment
There was a problem hiding this comment.
This worked for update command such as appium driver update xcuitest. Then, non-symlink modules got proper appium's ones. Once I copied the same thing in the removed await injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules')); place as my comment, it helped keep the behavior for the install as well
| // After the extension is installed, we try to inject the appium module symlink | ||
| // into the extension's node_modules folder if it is not there yet. | ||
| await injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules')); |
There was a problem hiding this comment.
const symlinkInjectionPromises = _.uniq([
...Object.values(this.config.installedExtensions).map(({installPath}) => installPath),
installPath,
]).map((installPath) => injectAppiumSymlink.bind(this)(path.join(installPath, 'node_modules')));
await B.all(symlinkInjectionPromises);
There was a problem hiding this comment.
e.g.
The ======== log was a log I have added before symlinkInjectionPromises to tell these changes passed explicitly.
kazu $ appium driver install xcuitest
✔ Checking if 'appium-xcuitest-driver' is compatible
✔ Installing 'xcuitest'
⚠ [debug] ======== log
ℹ Driver xcuitest@10.2.2 successfully installed
- automationName: XCUITest
- platformNames: ["iOS","tvOS"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 @appium
lrwxr-xr-x@ 1 kazu staff 63 Oct 19 23:44 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-idb
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-device
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-remotexpc
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-simulator
drwxr-xr-x@ 11 kazu staff 352 Oct 19 23:44 appium-ios-tuntap
drwxr-xr-x@ 11 kazu staff 352 Oct 19 23:44 appium-remote-debugger
drwxr-xr-x@ 16 kazu staff 512 Oct 19 23:44 appium-webdriveragent
drwxr-xr-x@ 8 kazu staff 256 Oct 19 23:44 appium-xcode
kazu $ appium driver install uiautomator2
✔ Checking if 'appium-uiautomator2-driver' is compatible
✔ Installing 'uiautomator2'
⚠ [debug] ======== log
ℹ Driver uiautomator2@5.0.5 successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 @appium
lrwxr-xr-x@ 1 kazu staff 63 Oct 19 23:47 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-idb
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-device
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-remotexpc
drwxr-xr-x@ 9 kazu staff 288 Oct 19 23:44 appium-ios-simulator
drwxr-xr-x@ 11 kazu staff 352 Oct 19 23:44 appium-ios-tuntap
drwxr-xr-x@ 11 kazu staff 352 Oct 19 23:44 appium-remote-debugger
drwxr-xr-x@ 16 kazu staff 512 Oct 19 23:44 appium-webdriveragent
drwxr-xr-x@ 8 kazu staff 256 Oct 19 23:44 appium-xcode
Current PR change (without my comment) worked this behavior for update
There was a problem hiding this comment.
👍
Moved it back to installViaNpm
Addresses appium/python-client#1177 (comment)