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): add appEntryPoint for executing electron directly with a main script #345

Closed
wants to merge 7 commits into from

Conversation

goosewobbler
Copy link
Member

@goosewobbler goosewobbler commented Dec 13, 2023

Prototyping the feature proposed in #331.

Copy link
Contributor

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome 🎉 I will make a PR to the config wizard to have this be the default behavior.

@goosewobbler
Copy link
Member Author

goosewobbler commented Dec 13, 2023

It will be awesome once it works 🤣 It's running electron but not managing to load the window in WDIO for the tests to work.

Loading manually with e.g. ./example-no-binary/node_modules/.bin/electron --app=./example-no-binary/dist/main.bundle.js loads the app fine...

@christian-bromann
Copy link
Contributor

I wonder if it is Chromedriver which passes some command line arguments that make it not work 🤔

@goosewobbler
Copy link
Member Author

goosewobbler commented Dec 30, 2023

I don't have the time to investigate why this isn't working at the moment, currently focussing on the mocking rework.

@goosewobbler goosewobbler linked an issue Dec 30, 2023 that may be closed by this pull request
@goosewobbler goosewobbler dismissed christian-bromann’s stale review December 30, 2023 16:58

CI build fails - window issue

@goosewobbler goosewobbler force-pushed the sm/electron-script-exec branch from ea56a5a to 76f9223 Compare February 10, 2024 11:14
@goosewobbler goosewobbler marked this pull request as draft March 19, 2024 18:06
@goosewobbler
Copy link
Member Author

goosewobbler commented Apr 10, 2024

I wonder if it is Chromedriver which passes some command line arguments that make it not work 🤔

I logged out the args being passed using a shell script:

--allow-pre-commit-input --app=/Users/sam/Workspace/wdio-electron-service/example-no-binary/test-main.js --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir=/var/folders/24/wq5vywfs5qd225vw7_p1bc180000gn/T/.org.chromium.Chromium.hJtLBV data:,

Not all of these are available on the list of command line switches but I can't see anything obviously causing this apart from perhaps the data:, at the end...

UPDATE: here are the args as logged out from process.argv on a successful run of the example E2Es. I think that rules out a Chromedriver arg issue.

[
  '/Users/sam/Workspace/wdio-electron-service/example/out/wdio-electron-service-example-darwin-arm64/wdio-electron-service-example.app/Contents/MacOS/wdio-electron-service-example',
  '--allow-pre-commit-input'
  '--bar=baz'
  '--disable-background-networking',
  '--disable-client-side-phishing-detection',
  '--disable-default-apps',
  '--disable-hang-monitor',
  '--disable-popup-blocking',
  '--disable-prompt-on-repost',
  '--disable-sync',
  '--enable-automation',
  '--enable-logging',
  '--foo',
  '--log-level=0',
  '--no-first-run',
  '--no-service-autorun',
  '--password-store=basic',
  '--remote-debugging-port=0',
  '--test-type=webdriver',
  '--use-mock-keychain',
  '--user-data-dir=/var/folders/24/wq5vywfs5qd225vw7_p1bc180000gn/T/.org.chromium.Chromium.UviaFl',
  'data:,'
]

@tanin47
Copy link

tanin47 commented Apr 17, 2024

but I can't see anything obviously causing this apart from perhaps the data:, at the end...

You can change it by providing appArgs = ['--user-data-dir=/tmp/test-chrome-2'] in launcher.js.

I've tried excluding all switches with cap['goog:chromeOptions']['excludeSwitches'] = ['user-data-dir', 'allow-pre-commit-input', 'test-type', 'disable-default-apps', ...] until only --remote-debugging-port and --user-data-dir are left (because for some reasons, they can't be exluded). It still doesn't work.

@goosewobbler
Copy link
Member Author

Closing in favour of #545

@goosewobbler goosewobbler deleted the sm/electron-script-exec branch August 21, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:wip Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start electron without a binary (i.e. electron main.js)
3 participants