5d1e1f8005
This commit brings numerous improvements to integration tests. The next step
will be to apply the same improvements to contract tests.
Fixes https://github.com/status-im/status-mobile/issues/18676
Improvements:
- Setting up the application and logged account per test is now done with an
async test fixture, which is a very idiomatic way to solve this problem. No
need anymore to write macros to wrap day8.re-frame.test/wait-for. The macros
in test-helpers.integration will be removed once we apply the same
improvements to contract tests.
- Integration test timeouts can be controlled per test, with a configurable,
global default (60s).
- Now the integration test suite will fail-fast by default, i.e. a test failure
short-circuits the entire suite immediately. This option can be overridden on
a test-by-test basis. This improvement is very useful when investigating
failures because the error will be shown on the spot, with no need to search
backwards across lots of logs.
- Noisy messages from re-frame can be silenced with a test fixture. We can
silence even more in the future if we remove the hardcoded printf call from
C++ on every signal and control it with Clojure. We can disable most logs as
well with the more direct (status-im.common.log/setup "ERROR") at the top of
tests.integration-test.core. We can make verbosity even more convenient to
control, but I think this should be designed outside this PR.
- Removed dependency on lib day8.re-frame/test for integration tests (see
detailed explanation below).
- Each call to (our) wait-for can customize the timeout to process re-frame
event IDs passed to it.
- Syntax is now flat, instead of being nested on every call to wait-for. You
can now compose other async operations anywhere in a test.
Notes:
- 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.
- There are lots of logs related to async storage ("unexpected token u in JSON at
position..."). This isn't fixed yet.
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. Whether it will be useful after we remove it from integration and
contract tests is yet to be seen (probably not).
A few reasons:
- The async model of promises is well understood and battle tested. The one
devised in the lib is poorly understood and rigid.
- There's basically no way to correctly integrate other async operations in the
test, unless they can be fully controlled via re-frame events. For instance,
how would you control timeouts? How would you retry in a test? How would
forcefully delay an operation by a few seconds? These things are useful (to me
at least) when developing integration/contract tests.
- Every call to day8.re-frame.test/wait-for forces you to nest code one more
level. Code readability suffers from that choice.
- Have you ever looked up the implementation of 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.
- The lib has an interesting macro run-test-sync, but we have no usage for it. I
used it in status-mobile for a while. At one point, all event unit tests for
the Activity Center used it (e.g. commit
|
||
---|---|---|
.clj-kondo | ||
.dependabot | ||
.github | ||
.lsp | ||
.vscode | ||
android | ||
ci | ||
doc | ||
fastlane | ||
ios | ||
logs | ||
maestro | ||
modules/react-native-status | ||
nix | ||
resources | ||
scripts | ||
src | ||
test | ||
test-resources | ||
translations | ||
.buckconfig | ||
.carve_ignore | ||
.dockerignore | ||
.env | ||
.env.e2e | ||
.env.jenkins | ||
.env.nightly | ||
.env.release | ||
.envrc | ||
.eslintrc.js | ||
.flowconfig | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.nycrc | ||
.prettierignore | ||
.prettierrc.js | ||
.watchmanconfig | ||
.zprintrc | ||
LICENSE.md | ||
Makefile | ||
README.md | ||
RELEASES.md | ||
VERSION | ||
app.json | ||
babel.config.js | ||
binding.gyp | ||
default.nix | ||
index.js | ||
metro.config.js | ||
package.json | ||
react-native.config.js | ||
shadow-cljs.edn | ||
shell.nix | ||
status-go-version.json | ||
supervisord.conf | ||
yarn.lock |
README.md
Status - a Mobile Ethereum Operating System
Join us in creating a browser, messenger, and gateway to a decentralized world. Status is a free (libre) open source mobile client targeting Android & iOS built entirely on Ethereum technologies. That's right, no middlemen and go-ethereum
running directly on your device.
Why?
We believe in a medium of pure free trade, economies with fair, permission-less access and a world without intermediaries. We want to create policies that can exist between friends or scale globally, we want to communicate securely and be uninhibited by legacy systems.
We want to take responsibility for our data, and the way we conduct ourselves privately and promote this way of life to a mass audience.
We want deep insights into our own economies so we can make informed, data-driven decisions on how to make our lives better. The Ethereum blockchain, Smart Contracts, Swarm and Whisper provide us with a path forward.
If this interests you, help us make Status a reality - anyone can contribute and we need everyone at any skill level to participate.
How to Contribute?
Go straight to the docs and choose what interests you:
-
Developer Developers are the heart of software and to keep Status beating we need all the help we can get! If you're looking to code in ClojureScript or Golang then Status is the project for you! We use React Native and there is even some Java/Objective-C too! Want to learn more about it? Start by reading our Developer Introduction which guides you through the technology stack and start browsing beginner issues. Then you can read how to Build Status, which talks about managing project dependencies, coding guidelines and testing procedures. Check out our coding guidelines.
-
Community Management Metcalfe's law states that the value of a network is proportional to the square of the number of connected users of the system - without community Status is meaningless. We're looking to create a positive, fun environment to explore new ideas, experiment and grow the Status community. Building a community takes a lot of work but the people you'll meet and the long-lasting relationships you form will be well worth it, check out our Mission and Community Principles
-
Specification / Documentation John Dewey once said, "Education is not preparation for life; education is life itself ". Developers and Designers need guidance and it all starts from documentation and specifications. Our software is only as good as its documentation, check out our docs and see how you can improve what we have.
-
Blog Writing Content is King, keeping our blog up to date and informing the community of news helps keep everyone on the same page.
-
Testers It's bug-hunting season! Status is currently under active development and there is sure to be a bunch of learning, build status from scratch or if an android user checks out our nightly builds. You can shake your phone to submit bug reports, or start browsing our Github Issues. Every bug you find brings Status closer to stable, usable software for everyone to enjoy!
-
Security Status is a visual interface to make permanent changes on the Blockchain, it handles crypto-tokens that have real value and allows 3rd party code execution. Security is paramount to its success. You are given permission to break Status as hard as you can, as long as you share your findings with the community!
-
Evangelism Help us spread the word! Tell a friend right now, in fact, tell everyone - yell from a mountain if you have to, every person counts! If you've got a great story to tell or have some interesting way you've spread the word about Status let us know about it in our chat
Give me Binaries!
You can get our Beta builds for both Android and iOS on our website, through our nightly builds, or by building it yourself.
Core Contributors
Special thanks to @adrian-tiberius. Without the dedication of these outstanding individuals, Status would not exist.
Contact us
Feel free to email us at support@status.im.
License
Licensed under the Mozilla Public License v2.0