medic / cht-android

A native Android container for Community Health Toolkit (CHT) applications
GNU Affero General Public License v3.0
25 stars 49 forks source link

Re-add tests for loading the last URL visited by the app #316

Open jkuester opened 1 year ago

jkuester commented 1 year ago

315 deleted the LastUrlTest.java file which was a UI Test (Android test):

Test that when the app is closed and then opened again, the last URL viewed is loaded instead of the app URL.

Unfortunately, these UI tests have not been properly running since #236 when changes to the brand naming (dropping Webapp) meant that the make commands for the UI tests would complete successfully, but no tests would actually get run. Then, #252 removed the DISABLE_APP_URL_VALIDATION functionality that was required for the LastUrlTest. (Since the UI tests were not actually running, we did not realize at the time that it was required for the test...)

I have considered simply re-adding DISABLE_APP_URL_VALIDATION so that the LastUrlTest can run, but that flag is essentially an obscene hack that would only be useful for this hacky test case. Instead, I am just removing the test in #315 and logging this issue so that someone (aka future me) can go figure out a better way to do this test that does not involve hacking all over the implementation code....

jkuester commented 1 year ago

To provide a little more detail here, the reason this test does not work without DISABLE_APP_URL_VALIDATION is because it relied on using a custom url (https://angular.io/start) that was not a CHT instance at all. I think this test should be re-written to just connect to a proper CHT instance. The non-trivial part is that this probably involves spinning up a test instance to connect to as part of the test suite...