Skip to content

test: add end-to-end demo smoke test - #1805

Merged
kikoso merged 5 commits into
mainfrom
test/demo-smoke-test
Oct 1, 2026
Merged

kikoso merged 5 commits into
mainfrom
test/demo-smoke-test

Conversation

@kikoso

@kikoso kikoso commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds an end-to-end smoke test for the demo app, so a broken demo is caught in CI instead of by users.

  • DemoSmokeTest (parameterized, one case per demo): starts MainActivity, opens the demo through the menu, waits for its map, zooms out and back in (which exercises the camera-idle path clustering and renderers hook into), checks the demo is still in the foreground, and navigates back. The two Street View demos have no map and are only checked for staying open.
  • DemoCatalogTest: fails if a demo activity is declared in the manifest but missing from the menu (or the other way round), so new demos added to demoGroups() are covered automatically.
  • Android Test Orchestrator: each test runs in its own process, so a crashing demo fails only its own case instead of aborting the run.
  • Demo smoke test workflow: runs the suite on an API 36 emulator with ACTIONS_API_KEY and requireMapLoaded=true. Skips with a notice when the secret is not available (forks, Dependabot).

Supporting changes: the demo list moved to a top-level demoGroups() in MainActivity.kt, menu rows got test tags, and AGENTS.md documents how to run it.

Notes

  • Without a Maps API key in a valid format the demos close themselves. A failed assumeTrue is reported as a failure by the test platform here, so instead the test generates no cases and logs a warning.
  • Gradle's class= runner argument only ran the first class of a comma-separated list, so the tests live in a smoke package and are filtered by package.
  • The workflow uses API 36. Emulators never update Google Play services, and API 34 images bundle 23.18, where adding advanced markers crashes inside Play services. API 36 bundles 25.26, which works.

Found by the test

The first CI runs with a real key caught two demo bugs, fixed here:

  • The demo manifest did not declare org.apache.http.legacy, which the Maps SDK needs when targeting API 28+ on devices with older Play services. 25 demos crashed with NoClassDefFoundError: org/apache/http/ProtocolVersion. The compose demo already declares it.
  • PolylineProgressDemoActivity called newLatLngBounds before the map was laid out ("Map size can't be 0"), which shows up on slower devices. It now waits for layout.

Testing

CI: Demo smoke test passes, 29/29 with ACTIONS_API_KEY and requireMapLoaded=true.

On a local API 34 emulator with a fake key in a valid format:

  • DemoCatalogTest 1/1 and DemoSmokeTest 28/28 pass (about 2:45).
  • With a crash injected into ClusteringDemoActivity, only that case failed and the other 27 still ran.
  • :demo:lintStandardDebug and :demo:testStandardDebugUnitTest pass.

Run locally with:

./gradlew :demo:connectedStandardDebugAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.package=com.google.maps.android.utils.demo.smoke

Opens every demo from the menu on an emulator, waits for its map, zooms
out and back in, and navigates back. DemoCatalogTest keeps the menu and
the manifest in sync so new demos are covered automatically.

Runs with Android Test Orchestrator so a crashing demo fails only its own
case. Adds a Demo smoke test workflow that uses ACTIONS_API_KEY and skips
when the secret is not available.
@kikoso
kikoso marked this pull request as ready for review October 1, 2026 09:13
@kikoso
kikoso requested a review from a team as a code owner October 1, 2026 09:13
@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 56.95% 🍏

There is no coverage information present for the Files changed

kikoso added 4 commits October 1, 2026 11:23
…polyline demo

Found by the demo smoke test on CI. On emulator images with older Google
Play services the Maps SDK needs org.apache.http.legacy when targeting
API 28+, and PolylineProgressDemoActivity called newLatLngBounds before
the map had a size.
The google_apis image only provides the legacy maps renderer, where adding
advanced markers crashes inside Google Play services.
Emulators never update Google Play services. The API 34 images bundle
23.18, which only loads the legacy maps renderer, where adding advanced
markers crashes inside Play services.

@dkhawk dkhawk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall this is fantastic work, @kikoso! Bringing end-to-end smoke testing under Android Test Orchestrator with DemoCatalogTest keeping the manifest and menu in sync is a huge reliability win for the repo. The fact that it already caught the legacy Apache HTTP dependency and the polyline bounds layout race proves its value immediately.

A couple of minor suggestions:

  1. LazyColumn scroll on group headers: In DemoSmokeTest.kt, consider adding .performScrollTo() before .performClick() on the group header as well (composeRule.onNodeWithTag(groupTestTag(group)).performScrollTo().performClick()). Since DemoList uses LazyColumn, on smaller screens or landscape mode, headers near the bottom (like Street View) might not be composed yet when clicked.
  2. Post-merge CI on main: Consider adding push: branches: [main] to .github/workflows/demo-smoke-test.yml so that post-merge commits and automated bot bumps to main are validated too.

LGTM! 🚀

@kikoso
kikoso merged commit 48d3371 into main Oct 1, 2026
13 checks passed
@kikoso
kikoso deleted the test/demo-smoke-test branch October 1, 2026 17:29
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