AI-assisted issue. Filed by agent driven by @soloturn via GDD.
Summary
KiwixSettingsScreenTest.testSettingsScreenCommonBehaviour has been failing intermittently in CI, on runs triggered by PRs with no relation to the settings screen or storage handling:
Root cause
SettingsRobot.clickExternalStoragePreference() / assertExternalStorageSelected() hardcode index 1 into the storage-device node list:
fun clickExternalStoragePreference(composeTestRule: ComposeContentTestRule) {
clickOnStorageItem(1, composeTestRule)
}
That list is populated in SettingsScreen.kt's storageCategory() from settingsUiState.storageDeviceList.forEachIndexed { ... } - one entry per volume the device/emulator actually reports. Internal storage is always present (index 0), but an external/SD volume is not guaranteed on every CI emulator configuration. When it's absent, the list has only one entry, and:
Both are the exact same bug, manifesting differently depending on which of the two call sites is hit.
Fix
Fixed in #5104: added SettingsRobot.hasExternalStorageDevice() and gated the external-storage steps in testSettingsScreenCommonBehaviour on it, leaving internal-storage coverage and the rest of the test unconditional.
Related
Summary
KiwixSettingsScreenTest.testSettingsScreenCommonBehaviourhas been failing intermittently in CI, on runs triggered by PRs with no relation to the settings screen or storage handling:AssertionError: Action performScrollTo() failed. Can't retrieve node at index '1' of 'TestTag = storageDeviceItemTestingTag'ComposeTimeoutException: Condition still not satisfied after 10000 ms, stack trace bottoming out inSettingsRobot.assertStorageSelected/assertExternalStorageSelectedRoot cause
SettingsRobot.clickExternalStoragePreference()/assertExternalStorageSelected()hardcode index1into the storage-device node list:That list is populated in
SettingsScreen.kt'sstorageCategory()fromsettingsUiState.storageDeviceList.forEachIndexed { ... }- one entry per volume the device/emulator actually reports. Internal storage is always present (index 0), but an external/SD volume is not guaranteed on every CI emulator configuration. When it's absent, the list has only one entry, and:clickOnStorageItem(1, ...)'s directonAllNodesWithTag(...)[1]throws immediately with the clear "Can't retrieve node at index 1" message (Recognize Wikipedia links and web-search intents as in-app searches #5059's symptom).assertStorageSelected(1, ...)'scomposeTestRule.waitUntil(TEST_PAUSE_MS_FOR_DOWNLOAD_TEST) { onAllNodesWithTag(...).fetchSemanticsNodes()[1]... }has the same out-of-bounds access inside the polling predicate;waitUntilswallows the exception on every poll and only surfacesComposeTimeoutExceptiononce the timeout is exhausted (feat: add a setting to disable animations for e-ink devices #5090's symptom).Both are the exact same bug, manifesting differently depending on which of the two call sites is hit.
Fix
Fixed in #5104: added
SettingsRobot.hasExternalStorageDevice()and gated the external-storage steps intestSettingsScreenCommonBehaviouron it, leaving internal-storage coverage and the rest of the test unconditional.Related