Skip to content

Conversation

@andreia-ferreira
Copy link
Collaborator

@andreia-ferreira andreia-ferreira commented Dec 19, 2025

Towards #3365

This PR focuses on implementing a E2E test that covers the full flow of filling a survey, including all supported task types.
The previous test implementation was relying too much on UIAutomator, which can make the tests slow and flaky. To address this, this PR introduces a new test architecture centered around a TestDriver abstraction and the Robot pattern

The following was implemented:

  • Introduced a TestDriver interface that defines the supported user interactions which the implementation then define how to perform. In this case, for the Android tests it will prioritize Espresso and ComposeTestRule, using UIAutomator only when necessary (system interactions, maps etc)
  • Added the Robot base class and its implementations to encapsulate the interactions specific for each page
  • Updated SurveyRunnerTest with the new pattern
  • Cover the full survey flow with tests

How to test
You can run the test locally by using the localDebug build variant while running the Firebase emulator on the ground-platform project. The current emulator data doesn't have the survey used in this test, you need to use the one which will be added in this PR: google/ground-platform#2327

Screen_recording_20251222_182518.webm

@shobhitagarwal1612 @gino-m PTAL?

…st-survey

# Conflicts:
#	app/src/main/res/layout/date_task_frag.xml
#	app/src/main/res/layout/time_task_frag.xml
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.91%. Comparing base (845ffda) to head (8393b98).

Files with missing lines Patch % Lines
...tform/android/ui/map/gms/features/PointRenderer.kt 0.00% 2 Missing ⚠️
...android/data/remote/firebase/FirestoreDataStore.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3414      +/-   ##
============================================
+ Coverage     69.89%   69.91%   +0.01%     
  Complexity     1596     1596              
============================================
  Files           318      318              
  Lines          8571     8569       -2     
  Branches        949      950       +1     
============================================
  Hits           5991     5991              
+ Misses         2004     2002       -2     
  Partials        576      576              
Files with missing lines Coverage Δ
...android/data/remote/firebase/FirestoreDataStore.kt 0.00% <0.00%> (ø)
...tform/android/ui/map/gms/features/PointRenderer.kt 19.04% <0.00%> (-3.18%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira andreia-ferreira marked this pull request as ready for review December 22, 2025 18:17
@gino-m
Copy link
Collaborator

gino-m commented Dec 22, 2025

This is excellent! How would this flow actually get triggered from GitHub Actions? I assume it would work against a local emulated db populated by the web test interactions?

@andreia-ferreira
Copy link
Collaborator Author

@gino-m I haven't updated the GitHub actions in this MR yet, I will do it in a follow up.

After adding these tests, I was thinking on updating and reusing the existing submit-test action in the Android repo to run them. As part of that, instead of relying on data produced by the web e2e tests, the action would run against Firebase emulator data pre-populated in this PR.

This removes a dependency on the web e2e, which I wasn’t able to run locally, and makes the Android tests more deterministic and easier to extend. Using pre-populated emulator data lets us test against a more varied and representative survey configuration (including all task types) without having to modify or re-run web e2e flows that currently would only create a single-task survey.

Let me know what you think, happy to discuss further

Copy link
Member

@shobhitagarwal1612 shobhitagarwal1612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 🧪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants