Publish
feat: allow appium to pass cli args to plugins
* feat: allow appium to pass cli args to plugins
* feat: add new method for getting cli args from plugin
* refactor: refactor how plugin cli args are recieved
* style: run lint
MODIFY
packages/appium-plugins/packages/base/lib/plugin.js
packages/appium-plugins/packages/base/lib/plugin.js
import { logger } from 'appium-support';
+
export default class BasePlugin {
// plugins can define new methods for the Appium server to map to command names, of the same
@@ -13,9 +14,12 @@ export default class BasePlugin {
// }
static newMethodMap = {};
- constructor (pluginName) {
+ constructor (pluginName, opts = {}) {
this.name = pluginName;
this.logger = logger.getLogger(`Plugin [${pluginName}]`);
+
+ // allow for args to be used by plugins
+ this.opts = opts;
}

MODIFY
packages/appium-plugins/packages/fake/lib/plugin.js
packages/appium-plugins/packages/fake/lib/plugin.js
@@ -5,12 +5,23 @@ import B from 'bluebird';
export default class FakePlugin extends BasePlugin {
+ constructor (pluginName, opts = {}) {
+ super(pluginName, opts);
+ }
+
+ async getFakePluginArgs () {
+ await B.delay(1);
+ return this.opts.pluginArgs;
+ }
static newMethodMap = {
'/session/:sessionId/fake_data': {
GET: {command: 'getFakeSessionData'},
POST: {command: 'setFakeSessionData', payloadParams: {required: ['data']}}
},
+ '/session/:sessionId/fakepluginargs': {
+ GET: {command: 'getFakePluginArgs'}
+ },
};
static fakeRoute (req, res) {

MODIFY
packages/appium-plugins/packages/fake/package-lock.json
packages/appium-plugins/packages/fake/package-lock.json
{
"name": "@appium/fake-plugin",
- "version": "1.0.0",
+ "version": "1.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {

MODIFY
packages/appium-plugins/packages/fake/package.json
packages/appium-plugins/packages/fake/package.json
"tags": [
"appium"
],
- "version": "1.0.0",
+ "version": "1.1.0",
"author": "Appium <maintainers@appium.io>",
"license": "Apache-2.0",
"repository": {

MODIFY
packages/appium-plugins/packages/images/package-lock.json
packages/appium-plugins/packages/images/package-lock.json
{
"name": "@appium/images-plugin",
- "version": "1.1.5",
+ "version": "1.1.6",
"lockfileVersion": 2,
"requires": true,
"packages": {

MODIFY
packages/appium-plugins/packages/images/package.json
packages/appium-plugins/packages/images/package.json
{
"name": "@appium/images-plugin",
- "version": "1.1.5",
+ "version": "1.1.6",
"description": "Plugin for working with images and image elements in Appium",
"main": "./build/index.js",
"repository": {

Publish

 - @appium/fake-plugin@1.1.0
 - @appium/images-plugin@1.1.6

feat: allow appium to pass cli args to plugins (#10)

* feat: allow appium to pass cli args to plugins

* feat: add new method for getting cli args from plugin

* refactor: refactor how plugin cli args are recieved

* style: run lint