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

userData directory on windows 7 while running tests #382

Closed
alexpopovme opened this issue Jul 11, 2019 · 3 comments
Closed

userData directory on windows 7 while running tests #382

alexpopovme opened this issue Jul 11, 2019 · 3 comments

Comments

@alexpopovme
Copy link

alexpopovme commented Jul 11, 2019

I have an issue with the app working directory on windows 7.
If I launch the built app it creates an "appName" directory in C:\Users\User\AppData\Roaming with a bunch of files, including my custom initialization JSON file.
But if the same app is launched by Spectron in tests it creates "appName" only with empty "log" directory without any files.
Is there any option or workaround to make the launch of the app from tests the same way as manual clicking on exe?

@alexpopovme
Copy link
Author

alexpopovme commented Jul 15, 2019

Forgot to mention that the app is built as PORTABLE

@alexpopovme
Copy link
Author

Some additional info, I'm using app.getPath('userData') to save the config file.
When running portable app userData is C:\Users\User\AppData\Roaming\appname.
But when running tests, which launch the same portable app, the userData is C:\Users\User\AppData\Local\Temp\scoped_dir7324_16815'.
This "scoped_dir7324_16815" is changing every time when I run tests, so I cannot use a previously saved config.
Can I change the userData path for tests and set it to be the same on every run?

@alexpopovme alexpopovme changed the title app working directory on windows 7 while running tests userData directory on windows 7 while running tests Jul 19, 2019
@alexpopovme
Copy link
Author

OK, I solved my issue, thanks to this post - https://hovancik.net/blog/2019/05/30/you-can-specify-chromedriver-s-user-data-directory-for-electron-app-s-tests/

chromeDriverArgs: [
    `--user-data-dir=${__dirname}/my-app-data`
  ]

I've also tried to use app.setPath(userData, my/path/from/env/var) as advised here - #202 (comment)
It'll change appData and save config file there, but tests won't run and will fail by timeout.

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

1 participant