Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use extra CLI flags (sometimes required by plugins) #17084

Closed
nextlevelbeard opened this issue Jun 22, 2022 · 10 comments
Closed

Cannot use extra CLI flags (sometimes required by plugins) #17084

nextlevelbeard opened this issue Jun 22, 2022 · 10 comments
Assignees
Labels
Needs Triage bugs which are not yet confirmed

Comments

@nextlevelbeard
Copy link

Some plugins like device-farm make use of CLI arguments passed to Appium.
For example: there is the plugin-device-farm-platform argument, which can take values android, ios or both

Since beta.26, you can specify the plugin to use, but you cannot specify any extra plugin arguments.

Without the argument, Appium runs but it is not properly configured:

npx appium \
--base-path / \
--port 4446 \
--allow-insecure="execute_driver_script,chromedriver_autodownload,adb_shell" \
--use-plugins="device-farm"

With the argument, Appium will throw an error:

npx appium \
--base-path / \
--port 4446 \
--allow-insecure="execute_driver_script,chromedriver_autodownload,adb_shell" \
--use-plugins="device-farm" \
--plugin-device-farm-platform=both
appium: error: unrecognized arguments: --plugin-device-farm-platform=both
@saikrishna321
Copy link
Member

@boneskull Has something changed with CLI args in latest beta?

@mykola-mokhnach
Copy link
Collaborator

AFAIK it is necessary for a plugin/driver to provide a schema where supported CLI args are described. See https://github.com/appium/appium/pull/17050/files#diff-3baee5b43161e5ca3169450387053776d15111d589a22e656715c1ef103c5688R387

@nextlevelbeard
Copy link
Author

They do specify a schema, @mykola-mokhnach

"appium": {
    "pluginName": "device-farm",
    "mainClass": "DevicePlugin",
    "schema": {
      "$schema": "http://json-schema.org/draft-07/schema",
      "additionalProperties": false,
      "description": "Appium configuration schema for the Device Farm plugin.",
      "properties": {
        "platform": {
          "type": "string"
        }
      },
      "title": "Fake Plugin Configuration",
      "type": "object"
    }
  }

Can we double check this is working for plugins?
Because the fake-plugin, unlike the fake-driver, has no such schema examples in place.

@mykola-mokhnach
Copy link
Collaborator

I do not observe any schema that describes CLI args. Nevertheless I might be wrong.

@mykola-mokhnach mykola-mokhnach added Needs Triage bugs which are not yet confirmed and removed Question labels Jun 22, 2022
@jlipps
Copy link
Member

jlipps commented Jun 22, 2022

this all looks correct except in the fake-driver example, schema is a path to a js file exporting the schema. so the device-farm plugin should probably be updated to conform to this pattern

@mykola-mokhnach
Copy link
Collaborator

xcuitest driver uses the same approach (schema inside package.json). Not sure which of these approaches is correct

@saikrishna321
Copy link
Member

Server command: appium server -ka 800 --use-plugins=device-farm --plugin-device-farm-platform=android -pa /wd/hub

[Appium] Attempting to load plugin device-farm...
[debug] [Appium] Requiring plugin at /Users/saikrishna/.appium/node_modules/appium-device-farm
In Con android
[Appium] Welcome to Appium v2.0.0-beta.40
[Appium] Non-default server args:
[Appium] {
[Appium]   basePath: '/wd/hub',
[Appium]   keepAliveTimeout: 800,
[Appium]   usePlugins: [
[Appium]     'device-farm'
[Appium]   ]
[Appium] }
[Appium] Attempting to load driver uiautomator2...
[debug] [Appium] Requiring driver at /Users/saikrishna/.appium/node_modules/appium-uiautomator2-driver
[device-farm] Device Farm Plugin will be served at http://localhost:4723/device-farm
[device-farm] If the appium server is started with different port other than 4723, then use the correct port number to access the device farm dashboard
[ADB] Found 2 'build-tools' folders under '/Users/saikrishna/Library/Android/sdk' (newest first):
[ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/31.0.0
[ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/30.0.2
[ADB] Using 'adb' from '/Users/saikrishna/Library/Android/sdk/platform-tools/adb'
[debug] [ADB] Running '/Users/saikrishna/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
[debug] [ADB] Getting connected devices
[debug] [ADB] No connected devices have been detected
[device-farm] Device list updated: []
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] Available drivers:
[Appium]   - uiautomator2@2.1.0 (automationName 'UiAutomator2')
[Appium] Available plugins:
[Appium]   - relaxed-caps@1.0.0-beta.6
[Appium]   - element-wait@1.0.0-beta.4
[Appium]   - device-farm@1.0.0-beta.16 (ACTIVE)

Can't reproduce the error

@boneskull
Copy link
Contributor

schema can be a path to a JSON schema or it can be a schema itself.

@boneskull
Copy link
Contributor

This sounds like it's been resolved, so I'll close it.

@saikrishna321
Copy link
Member

@boneskull Can we load all the plugins CLI args from a file? Currently, the plugin device-farm has three CLI args and may to come.

appium server -ka 800 --use-plugins=device-farm --plugin-device-farm-platform=android --plugin-device-farm-simulator-skip=ios something-blah -pa /wd/hub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage bugs which are not yet confirmed
Projects
None yet
Development

No branches or pull requests

5 participants