fix: plugins should get inner driver, not umbrella driver
MODIFY
lib/appium.js
lib/appium.js
@@ -421,7 +421,9 @@ class AppiumDriver extends BaseDriver {
};
// now take our default behavior, wrap it with any number of plugin behaviors, and run it
- const wrappedCmd = this.wrapCommandWithPlugins({cmd, args, plugins, cmdHandledBy, next: defaultBehavior});
+ const wrappedCmd = this.wrapCommandWithPlugins({
+ driver: dstSession, cmd, args, plugins, cmdHandledBy, next: defaultBehavior
+ });
const res = await this.executeWrappedCommand({wrappedCmd, protocol});
// if we had plugins, make sure to log out the helpful report about which plugins ended up
@@ -431,7 +433,7 @@ class AppiumDriver extends BaseDriver {
return res;
}
- wrapCommandWithPlugins ({cmd, args, next, cmdHandledBy, plugins}) {
+ wrapCommandWithPlugins ({driver, cmd, args, next, cmdHandledBy, plugins}) {
plugins.length && log.info(`Plugins which can handle cmd '${cmd}': ${plugins.map((p) => p.name)}`);
// now we can go through each plugin and wrap `next` around its own handler, passing the *old*
@@ -444,7 +446,7 @@ class AppiumDriver extends BaseDriver {
next = ((_next) => async () => {
log.info(`Plugin ${plugin.name} is now handling cmd '${cmd}'`);
cmdHandledBy[plugin.name] = true; // if we make it here, this plugin has attempted to handle cmd
- return await plugin.handle(_next, this, cmd, ...args);
+ return await plugin.handle(_next, driver, cmd, ...args);
})(next);
}

fix: plugins should get inner driver, not umbrella driver