👋 Try our app |
---|
⬇ Download the FlowCrypt app on your device from the FlowCrypt Downloads page. |
This guide follows Google's recommendations for testing apps on Android. Every scenario described in this section has been tested on Ubuntu. There are JUnit and Instrumentation tests. To be able to run tests locally, you should set up your environment.
Please follow these steps to setup your virtual or physical device:
HTTPS 433
port by default to run a web server on the localhost (127.0.0.1)
. That's why we have to run a mock web server on another port (for example, 1212
) and route all traffic from 127.0.0.1:433
to 127.0.0.1:1212
. For that purpose, you can use the script/ci-wait-for-emulator.sh script.*.flowcrypt.test
. All traffic to *.flowcrypt.test
should be routed to localhost (127.0.0.1)
. You can use a DNS server to do this. For example, using these commands:1. sudo apt install -y dnsmasq resolvconf
2. echo "#added by flowcrypt" | sudo tee -a /etc/dnsmasq.conf
3. echo "listen-address=127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
4. echo "address=/flowcrypt.test/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
5. echo "address=/localhost/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
6. sudo systemctl restart dnsmasq
We have two types of tests:
@DependsOnMailServer
annotation.Additionally, we have separate tests for the consumer and enterprise versions. Enterprise tests are marked with the @EnterpriseTest
annotation. These tests use the Gmail API and are independent of the mail server.
We run tests on Semaphore CI for every commit. To run tests that depend on an email server, we use a custom Docker image, which extends docker-mailserver. This image has predefined settings for local testing. It has accounts and messages which we need for testing. You can investigate the docker-mailserver
folder to see more details. To be able to run tests that depend on an email server, please install docker-compose
following the official instructions.
⬇️ Please follow these steps to run the independent tests locally:
../script/ci-instrumentation-tests-without-mailserver.sh 1 0
(where 1
is a numShards
and 0
is a shardIndex
). You can find more details if you read the guide concerning AndroidX test libraries on sharding tests. It helps us run them in pieces on a few emulators at the same time to reduce runtime.⬇️ Please follow these steps to run tests that depend on an email server locally:
./docker-mailserver/run_email_server.sh
and wait while the email server is started.../script/ci-instrumentation-tests-with-mailserver.sh
../docker-mailserver/stop_email_server.sh
to stop the email server.⬇️ Please follow these steps to run all tests locally:
./docker-mailserver/run_email_server.sh
and wait while the email server is started../script/run-all-tests.sh
to execute all tests../docker-mailserver/stop_email_server.sh
to stop the email server.⬇️ Please follow these steps to run enterprise tests locally:
./script/ci-instrumentation-tests-enterprise.sh
to execute enterprise tests.This section describes two main steps you need to accomplish to run the app in the emulaor:
Please follow these steps to be able to install and run the emulator:
1. Run AVD Manager from Tools ➜ AVD Manager or click on the highlighted icon:
2. Click on Create Virtual Device:
3. Select the hardware: Pixel 4 will be a good choice. After, click Next:
4. Download one of the latest available system images:
5. Click Finish:
6. Select the downloaded image and click Next:
7. Once you click Next, you'll see the final screen where you should click Finish:
8. AVD Manager will show a new emulator. Click the green triangle to run the emulator:
9. Once running, you'll see the home screen of the emulator:
Please follow these steps to be able to build and run the app:
1. First of all, you should select the correct version of the build variants. Please use consumerDebug
:
2. Make sure that your emulator is selected:
3. Now, you can run the app via Run ➜ Run(Alt+Shift+F10) or click on the green Run button:
4. You'll see the app on the emulator in a few minutes (it depends on the hardware performance characteristics):