-
Notifications
You must be signed in to change notification settings - Fork 984
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
Make integration tests more enjoyable to use #19025
Make integration tests more enjoyable to use #19025
Conversation
Jenkins BuildsClick to see older builds (19)
|
fe98ab9
to
4c98312
Compare
Either works for me. About that PR, if this one gets merged before it, will just close it afterwards. The changes there were mostly for demonstration purposes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sooo much nicer to work with ❤️🔥
also, regarding adding the whole team as reviewers, I think you can just add status-mobile/mobile-devs
and status-mobile/wallet-mobile-devs
without adding each dev manually and hitting the reviewer limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very cool ✅, thanks for setting this up 🙏
src/test_helpers/integration.cljs
Outdated
|
||
;;;; Fixtures | ||
|
||
(defn fixture-logged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit comment: Reading fixture-logged
makes me think this might have something to do with logging of events or something. Perhaps this could be fixture-login-logout
or fixture-session
? Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your fixture-session
suggestion. Thanks @seanstrom
41fa08b
to
5e2114d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review @ilmotta
It looks a lot better! 💯
I hope this API continues improving as we create more tests
|
||
;;;; Fixtures | ||
|
||
(defn fixture-session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While trying to use async fixtures I remembered of your suggestion in one of our Discord channels. Thanks @ulisesmac
(use-fixtures :each (h/fixture-session)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @ilmotta - I'll wait with my pr until this one is merged! Much better! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean and tidy 🚀
Thanks a lot for this PR! ❤️
@ilmotta the promesa PR passed the QA and was merged, so I guess you can rebase |
5e2114d
to
79bf133
Compare
c8ef90f
to
e76a48f
Compare
e76a48f
to
f4781c9
Compare
Fixes #18676
Summary
This PR brings numerous improvements to integration tests. The next step would be to apply the same improvements to contract tests, but I preferred to not touch them here because they're changing more often (manual rebase issues) and because this PR is already reasonably large.
Improvements:
day8.re-frame.test/wait-for
. The macros intest-helpers.integration
will be removed once we apply the same improvements to contract tests.printf
call from C++ on every signal and control it with Clojure (confirmed with Andrea this is fine). Everything is just as noisy as before this PR. It's just that now we have a better way to control it during development. We can disable most logs as well with the more direct(status-im.common.log/setup "ERROR")
at the top oftests.integration-test.core
. We can make verbosity even more convenient to control, but I think this should be designed outside this PR.day8.re-frame/test
for integration tests (see detailed explanation below).wait-for
can customize the timeout to process re-frame event IDs passed to it.wait-for
. You can now compose other async operations anywhere in a test. This is what allows us to timeout individualwait-for
calls and the whole test integration.Notes
develop
. Wdyt is the best course of action @clauxx?promesa.core/do
is essential in the integration test suite, as it makes sync & async operations play nice with each other without the developer having to promisify anything manually.unexpected token u in JSON at position...
). I didn't try to fix this, but it would be super nice if we do in the future.Are we not going to use
day8.re-frame.test
?We don't need this library in integration tests and we won't need it in contract tests (follow-up PR). Whether it will be useful after we remove it from integration and contract tests is yet to be seen (probably not).
A few reasons:
day8.re-frame.test/wait-for
forces you to nest code one more level. Code readability suffers from that choice.wait-for
? It's quite convoluted. One could say the source code is not that important, but many times I had to look it up because I couldn't understand the async model they built with their macro approach. The de facto primitive in JS for asynchronicity is promises, and we fully leverage it in this PR.run-test-sync
, but we have no usage for it. I used it instatus-mobile
for a while. At one point, all event unit tests for the Activity Center used it (e.g. commit 08fb0de), but I replaced them with the simpler pure function style.@ulisesmac, @mohsen-ghafouri you were removed as reviewers due to the 15 reviewer limit. Your feedback is just as welcome :)
Areas that may be impacted
None. Only integration tests were touched. If they pass, the PR is good to go.
Steps to test
make test-integration
ormake test
status: ready