appium 2.0 should automatically install a default set of drivers
See original GitHub issueThe problem
Appium 1, as we know, is batteries-included: when you install appium@1
, you get drivers. It’s all one package. This is not the case with Appium 2. To get the drivers which were previously included, users must take extra steps (e.g., appium driver install <driver>
perhaps multiple times).
While we personally may not feel this pain, I cannot emphasize enough how poor this experience is for users. A major complaint for the past many years in the JS ecosystem has been this: packages like Babel don’t do much and you have to install a slew of plugins to make it do literally anything. When you install software, that software should do something.. Sensible defaults, in other words.
I get the rationale behind decoupling modules. However, “the unix philosophy” (like anything in software development) is a tradeoff. I assert (without any evidence, mind you) that this philosophy is precisely why the command-line is so daunting to new developers (I’m done shaking my fist at clouds now).
Potential Solutions
So: Appium should do something about this. There are several ways to go about it, with the ultimate goal of providing a better out-of-box-experience. Ideas:
- A metapackage. Unfortunately, this will be confusing for users if any package name is chosen except
appium
. So then, the metapackage would beappium
, and theappium@2.x
inpackages/appium
would become e.g.,@appium/core
(I am going to hand-wave over implementation details for now). - Abuse
postinstall
to checkAPPIUM_HOME
for installed drivers, and install the default set if no drivers are found. - On the first run of the server, check for drivers. If none are installed, install the default set, then continue. Provide a command-line flag to disable this behavior. I’m unsure of the interaction with
--driver
here, but I think the behavior could safely be disabled in that case (since--driver nonexistent-driver
should fail anyway).
I prefer either 1 or 3.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top GitHub Comments
@StephanB75 I don’t think it’s possible for Appium, when it’s being installed, to know what is in the package.json of the project that is installing it as a dependency. However you could create a
postinstall
script in your project that installs drivers, for example:in this case, when you
npm install
in the package, it will run these commands automatically. note that you’d probably also want to set a distinctAPPIUM_HOME
env for each project unless you want them to share drivers.Please see https://github.com/appium/appium/discussions/16149 for discussion about installation of drivers via npm.
That’s something I’d like to address, but isn’t the aim of this issue (however, it may be a prerequisite).