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

Added browserVersion to startElectron #852

Conversation

hpsjakob
Copy link

@hpsjakob hpsjakob commented Dec 5, 2024

Hello,

I'm using the wdio-electron-service for programmatically starting electron.
In my case it's not possible to auto detect the electron version, since the UI-Tests are in a separate project.

For that reason I'd like to pass the version as browserVersion to startElectron. Unfortunately that's not possible until now as it's not part of the electron capabilities.

This PR adds the browserVersion to startElectron but keeps it backward compatible. I added it to an interface so that additional parameters can be added in the future.
Please let me know if you like the approach of if you’ve a different idea how to solve this challenge.

Regards,
Jakob

@goosewobbler
Copy link
Member

goosewobbler commented Dec 6, 2024

Hi Jakob,

What's the actual issue behind the PR - why exactly do you need browserVersion here? Are you getting an error running the service with your project?

I can see that browserVersion is not being supplied to the capabilities, so the first operand in this line is never going to affect the electronVersion value:

const electronVersion = cap.browserVersion || localElectronVersion || '';

Presumably you are using appBinaryPath to specify where your app binary is. In the first instance I suggest we can detect the Electron version from the nearest package.json to that path, in the same way that we check the local Electron version.

e.g.

const electronVersion = appBinaryElectronVersion || localElectronVersion || '';

@hpsjakob
Copy link
Author

hpsjakob commented Dec 9, 2024

You're right. I'm setting appBinaryPath. The reason for that is my projet structure:

/package.json <-- electron-build
/e2e-test/package.json <-- wdio tests

I had to choose this project structure as I want to seperate the dependencies (That is required since I use a native lib once in electron and once on the test host).

Would it make sense to then instead pass something like appProjectDir instead of appBinaryDir? Then we could use the existing logic to auto-detect binary path and version.

@goosewobbler
Copy link
Member

Work on this is continuing in #858.

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

Successfully merging this pull request may close these issues.

2 participants