Observed
The screenshot CI workflow (feature/real-screenshots) goes green and produces fastlane/metadata/android/en-US/images/phoneScreenshots/01_widget.png, but the captured image shows a bare home screen with no widget on it.
Root cause
WidgetScreenshotTest.placeWidget() uses UIAutomator2 selectors that find something in the Launcher3 widget picker but don't actually land the widget on the home screen. The instrumentation exits 0 because no error() call is reached (the selectors succeed individually), but the drag either targets the wrong element or drops it outside the home grid.
Likely causes:
By.res("com.android.launcher3:id/workspace") may resolve to the outer container, making the long-click land on a wrong target (or open the app drawer instead of the widget picker)
By.textContains("Debug Mode") in the widget picker may match the app header label but not the actual draggable widget preview tile
- The drag destination (
displayWidth/2, displayHeight/4) may be outside the safe drop zone of the grid
Fix direction
- Dump the UI hierarchy (
uiautomator dump) during the widget picker step to identify the correct resource IDs and class names for API 33 Launcher3
- Use
By.clazz("android.widget.TextView").text("Widgets") or By.res("com.android.launcher3:id/widget_button") for the picker trigger
- For the widget tile, use the exact resource ID of the draggable preview cell in the picker
- After the drag, assert that a view with package
info.yuryv.androiddebugmode is present on the home screen before taking the screenshot
Related
Branch: feature/real-screenshots
Workflow: .github/workflows/screenshots.yml
Test class: app/src/androidTest/java/info/yuryv/androiddebugmode/screenshot/WidgetScreenshotTest.kt
Observed
The screenshot CI workflow (
feature/real-screenshots) goes green and producesfastlane/metadata/android/en-US/images/phoneScreenshots/01_widget.png, but the captured image shows a bare home screen with no widget on it.Root cause
WidgetScreenshotTest.placeWidget()uses UIAutomator2 selectors that find something in the Launcher3 widget picker but don't actually land the widget on the home screen. The instrumentation exits 0 because noerror()call is reached (the selectors succeed individually), but the drag either targets the wrong element or drops it outside the home grid.Likely causes:
By.res("com.android.launcher3:id/workspace")may resolve to the outer container, making the long-click land on a wrong target (or open the app drawer instead of the widget picker)By.textContains("Debug Mode")in the widget picker may match the app header label but not the actual draggable widget preview tiledisplayWidth/2,displayHeight/4) may be outside the safe drop zone of the gridFix direction
uiautomator dump) during the widget picker step to identify the correct resource IDs and class names for API 33 Launcher3By.clazz("android.widget.TextView").text("Widgets")orBy.res("com.android.launcher3:id/widget_button")for the picker triggerinfo.yuryv.androiddebugmodeis present on the home screen before taking the screenshotRelated
Branch:
feature/real-screenshotsWorkflow:
.github/workflows/screenshots.ymlTest class:
app/src/androidTest/java/info/yuryv/androiddebugmode/screenshot/WidgetScreenshotTest.kt