-
Notifications
You must be signed in to change notification settings - Fork 865
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 spectron startup test #730
Conversation
The app wont shutdown due to how we keep the webui window open. We don't want to consume system resources keeping multiple windows open, so we need to refactor things to not expect a stable webui window on the context. License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
Merge master onto feat/add-electron-tests
@olizilla I pushed a small fix to master and then merged it onto this branch. It fixes the issue where the app wouldn't close on |
So, let's take a look of what's missing. By injecting
@olizilla anything missing? |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
@olizilla @fsdiogo I created some tests but they only seem to be passing on macOS. They work locally on Windows. I followed the instructions for Spectron on Travis and AppVeyor but it still doesn't seem to work. I will AFK for the next couple of hours. It would be awesome if you could take a look at this please. |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
Just an update: I just updated the tests and they now also mock the home directory so they can be safely run at your computer and they won't change your configurations, nor your IPFS Desktop settings. On Windows, it seems to be opening tons of empty command line windows and it makes the tests hang. I have to manually click 'Quit' on IPFS Desktop to finish each test manually. Here's a related issue on Spectron: electron-userland/spectron#60. Despite this issue, they seem to be testing what they should test. I'm waiting for the CI to see how they behave on other OSes. Although I'm expecting them to fail on Linux (as they were before) and on Windows (due to the command line windows...). Hopefully macOS tests will pass, as they were before. |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
One more update: I noticed the reason for tests to be failing is not the daemon, is not spectron. It's the Web UI window. Most of the times it can't quit so I decided to remove the Window completely and now the tests pass... This might also be related to the issue @lidel has reported which required multiple clicks on 'Quit' to close IPFS Desktop (#781). In other "news", I decided to allow failures on Linux because of two reasons: only OS where the tests don't pass and we are setting Linux support as experimental since it doesn't work well on all desktop environments: #788 (comment). /cc @ipfs-shipyard/gui |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
I managed to fix this in the meanwhile - and actually I don't think it's related to #781 anymore - by setting the node integrations to Ref.: electron-userland/spectron#347 On a brighter side, we now have tests for the most important startup scenarios! |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
@olizilla I'm merging this tests so we can work on other tests on top of these. They're passing and look good. We can change anything later if needed. |
This PR adds a basic (the text book) spectron test, modified just enough to make it work with our app
Right now our app won't close after testing, and I have narrowed it down to the way that we keep the webui window active in
https://github.com/ipfs-shipyard/ipfs-desktop/blob/f06cc5919682ba80009bceb07c39a210dfd63e66/src/hooks/webui/index.js#L29-L33
This seems to cause the call to
app.stop()
in the spectron api to fail. To fix this and more importantly to be kind on users system resources, i think we should avoid keeping the webui window running. I think we should open it when the app is first run, and destroy it when the user closes the window, and create a new one if they choose to open it again. This will require refactoring how we handle the config toggle, as it expects to be able to pull the window from the context. I think we should decouple that.TODO: