Skip to content

test: add a smoke test that opens every ApiDemos demo - #2446

Draft
kikoso wants to merge 2 commits into
mainfrom
test/apidemos-smoke-test
Draft

kikoso wants to merge 2 commits into
mainfrom
test/apidemos-smoke-test

Conversation

@kikoso

@kikoso kikoso commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an end-to-end smoke test for ApiDemos, matching the ones in android-maps-utils (#1805) and android-maps-compose (#1007).

For every demo activity in java-app and kotlin-app (read from the manifest, so new demos are picked up with no test change), the test:

  • launches it and checks it reaches RESUMED,
  • waits for its map or Street View panorama (MapView, StreetViewPanoramaView, SupportMapFragment or SupportStreetViewPanoramaFragment) to be laid out and ready,
  • zooms the map out and back in, waiting for tiles when requireMapLoaded=true,
  • recreates the activity and checks it again,
  • fails on any uncaught exception.

Demos that need a map ID (advanced markers and the two data-driven styling demos) are skipped when none is configured.

Bugs it found (fixed here)

  • BackgroundColorCustomizationProgrammaticDemoActivity (Kotlin) cast the map type switch to CheckBox, so it crashed on rotation. It also only called getMapAsync after a recreate, so on first launch the toggle did nothing. Now matches the Java version.
  • LayersDemoActivity (Kotlin) crashed on rotation: the spinner calls onItemSelected with a null view, and the override declared it non-null. Same signature fixed in CircleDemoActivity and PolylineDemoActivity.

CI

  • New demo-smoke-test.yml runs both apps on an API 36 emulator (Ubuntu with KVM). Older images bundle a Play services version where advanced markers crash.
  • instrumentation-test.yml excludes the smoke package.
  • Both apps now use the Android Test Orchestrator, so one crashing demo does not abort the rest of the run.

Like the existing instrumentation workflow, this needs the ACTIONS_API_KEY secret, which this repo does not have yet, so the job is skipped until an admin adds it.

Local results (API 34 emulator, real key)

  • kotlin-app: 86 tests, all pass except 6 skipped for the map ID. One result (demoLaunchesAndShowsMap[PolylineDemoActivity]) was missing from the full run's report and passed when rerun alone.
  • java-app: 86 tests, all pass except 6 skipped for the map ID.

The Gradle report lists skipped tests as failures, but the build passes.

A follow-up will add a menu navigation test once the catalog stack (#2422 to #2428) lands.

BEGIN_COMMIT_OVERRIDE
fix: crash on rotation in Kotlin BackgroundColorCustomizationProgrammaticDemoActivity
fix: crash on rotation in Kotlin LayersDemoActivity
test: add a smoke test that opens every ApiDemos demo
END_COMMIT_OVERRIDE

kikoso added 2 commits October 1, 2026 21:52
BackgroundColorCustomizationProgrammaticDemoActivity cast the map type
switch to CheckBox, which crashed on recreate, and never requested the
map on first launch. The spinner demos declared the selected view as
non-null, which crashed LayersDemoActivity on recreate.
Each demo in java-app and kotlin-app is launched, its map or panorama
must become ready, the map is zoomed out and in, and the activity is
recreated. Demos are read from the manifest, so new ones are covered
automatically. Runs in a separate workflow on an API 36 emulator.
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.

1 participant