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

[Feat]: Allow passing resolved drivers to reliably embed Appium with drivers into an npm package #19883

Open
naruaway opened this issue Mar 12, 2024 · 0 comments
Labels

Comments

@naruaway
Copy link

naruaway commented Mar 12, 2024

Is your feature request related to a problem? Please describe.
When embedding Appium with some drivers into a single npm package, I would like Appium to reliably discover the drivers. However, Appium's useDrivers param only accepts string and we can pass neither the full path of drivers nor actual driver module. What we can do is to pass the parent directory of node_modules as appiumHome and hope that the drivers are installed into that node_modules directory. However, depending on the environment, the drivers might be installed in different node_modules such as in the parent's directory. This can cause unpredictable behavior.

Describe the solution you'd like
Appium should support "embedded" use case like the following:

import appium from "appium";
import xcuitestDriver from "appium-xcuitest-driver"

await appium.main({
    useDrivers: [xcuitestDriver],
});

In this code, we are directly passing the actual instance of appium-xcuitest-driver. So that we can completely bypass Appium's own way of discovering drivers and we can simply rely on Node.js's module discovery mechanism, which is easier to reason about and consistent with other parts of the system.

Conceptually, this is similar to how ESLint flat config works, where users need to explicitly import ESLint plugins without relying on ESLint's its own plugin discovery mechanism. It looks like this is a recent trend to let Node.js resolve "plugins" without relying on library specific discovery mechanism.

Additional context
I am not sure about the other usage of appiumHome except for discovering the drivers but we might want to have this automatically configured (e.g. just node_modules where appium is installed) for the embedded use case as well. We might want to have additional flag to opt-in this behavior

@naruaway naruaway changed the title [Feat]: Allow passing already resolved drivers in useDrivers for reliably embedding Appium into an npm package with drivers [Feat]: Allow passing resolved drivers to reliably embed Appium with drivers into an npm package Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants