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

Detect unavailable binaries as such #187

Closed
vemv opened this issue Dec 30, 2018 · 3 comments
Closed

Detect unavailable binaries as such #187

vemv opened this issue Dec 30, 2018 · 3 comments
Assignees

Comments

@vemv
Copy link

vemv commented Dec 30, 2018

Problem statement

Etaoin does not seem to detect whether a binary, e.g. :chrome, is actually a reachable (or valid) binary.

I've faced at least two scenarios:

  • chromedriver is missing, forgot to install
  • chromedriver is there, but shadowed by another program called chromedriver: a Ruby gem.

In both cases, the situation is not clear to one when encountering Etaoin errors. I simply see generic timeout errors, which are a waste of time because they tend to lead me to think that there's something wrong with the codebase or the integration tests themselves.

Suggestion

Before trying to use a binary, perform a sanity check.

For example, ~/$ chromedriver --version returns ChromeDriver 2.44.609545 (c2f88692e98ce7233d2df7c724465ecacfe74df5), and performs instantly.

Other drivers predictably can also be queried in a similar fashion.

So, one can implement these 'checkers' which execute the --version command againt an expected output.

The only open question is how often to perform these checks. On every single test? Once? Eagerly, lazily? Etc.

Don't know if you have played with these ideas already in the past.

WDYT?

I can contribute a full implementation if you foresee it'll get into Etaoin.

Cheers - Victor

@igrishaev
Copy link
Collaborator

Good idea! I believe we can check if a binary exists, and when it does not, throw a clear message saying what is missing and where it might be reached.

@igrishaev
Copy link
Collaborator

Two ways to solve the issue:

  1. when spawning a process, check if there is a special exception meaning there is no a binary file (say, FileNotFoundException). If that case, catch that exception and throw a new one with the detailed message.

  2. another way to check is to create a function or rather a multimethod that runs a binary with the --version or --help arguments. The exit code must be zero. When it's not, throw an error.

Pay attention, different drivers may behaive in different ways. Say, some of them accept --version and others not. That's why I suggested using a multimethod.

Another point, the error message must be clean. For example, "Cannot find a binary file for the driver. Please ensure you have the driver installed and specify the path to it. For driver installation, check out the official readme file from Etaoin: http://github.../etaoin/readme#..."

@igrishaev
Copy link
Collaborator

To prevent doing this check every time, consider using a memoized version of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants