fix(appium): stop calling plugins 'sessionless' since the name is immutable
and plugins can now migrate from sessionless to session-based
MODIFY
packages/appium/lib/appium.js
packages/appium/lib/appium.js
@@ -391,19 +391,17 @@ class AppiumDriver extends BaseDriver {
* @returns {Array} - array of plugin instances
*/
pluginsForSession (sessionId = null) {
- let plugins = [];
if (sessionId) {
if (!this.sessionPlugins[sessionId]) {
this.sessionPlugins[sessionId] = this.createPluginInstances();
}
- plugins = this.sessionPlugins[sessionId];
- } else {
+ return this.sessionPlugins[sessionId];
+ }
+
if (_.isEmpty(this.sessionlessPlugins)) {
this.sessionlessPlugins = this.createPluginInstances();
}
- plugins = this.sessionlessPlugins;
- }
- return plugins;
+ return this.sessionlessPlugins;
}
/**
@@ -423,16 +421,11 @@ class AppiumDriver extends BaseDriver {
.filter((p) => _.isFunction(p[cmd]) || _.isFunction(p.handle));
}
- createPluginInstances (sessionId) {
- if (!sessionId) {
- sessionId = 'sessionless';
- }
- sessionId = _.truncate(sessionId, {length: 11});
+ createPluginInstances () {
return this.pluginClasses.map((PluginClass) => {
- const generalName = PluginClass.pluginName;
- const name = `${generalName} (${sessionId})`;
+ const name = PluginClass.pluginName;
const plugin = new PluginClass(name);
- this.assignCliArgsToExtension('plugin', generalName, plugin);
+ this.assignCliArgsToExtension('plugin', name, plugin);
return plugin;
});
}

fix(appium): stop calling plugins 'sessionless' since the name is immutable
and plugins can now migrate from sessionless to session-based