[MBL-19679][Teacher][Parent] Add E2E tests for inbox attachment download and opening#3504
Conversation
refs: MBL-19679 affects: Teacher release note:
refs: MBL-19679 affects: Parent release note:
…achment-download-and-opening
There was a problem hiding this comment.
Review Summary
This PR adds E2E tests for Inbox message reply and forward functionality with file attachments (video and PDF) for both Parent and Teacher apps. The tests cover important user workflows and the overall structure is well-organized with clear logging.
Positive Aspects
- Comprehensive test coverage for reply/forward with attachments
- Clear, descriptive logging with PREPARATION_TAG, STEP_TAG, and ASSERTION_TAG
- Good use of assertions to verify both message content and attachment display
- Tests verify workflows from multiple user perspectives (parent1/parent2, teacher1/teacher2)
- Proper test infrastructure additions (FileChooserPage, test utility methods)
- Integration with WorkManager test helpers in TestAppManager
Issues Found
-
Test Reliability - Hard-coded sleep() calls (apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt:700, 715, apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt:810, 843, 968): Multiple uses of
sleep(2000)andsleep(5000)make tests flaky and slow. Replace with IdlingResource, WorkManager test helpers, or polling mechanisms with timeouts. -
Incorrect comment (apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt:696): Comment says "PDF file" but the code works with a video file.
-
Legacy storage flag (apps/parent/src/main/AndroidManifest.xml:43): Adding
android:requestLegacyExternalStorage="true"is deprecated and has no effect on Android 11+. Consider using scoped storage APIs instead. -
Brittle UiAutomator file picker interaction (apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt:935-947): Direct UiAutomator interaction with system file picker is fragile across devices/locales. Consider using Espresso intents to stub the file picker (like the parent app does).
Recommendations
- Create a shared helper method for waiting on file uploads that uses WorkManager test helpers instead of sleep()
- Add timeout and error handling to UiAutomator interactions for better debugging
- Document or remove the legacy storage flag if it's not needed
- Consider using stubbed file picker intents consistently across both apps for better test reliability
The functionality being tested is valuable, and the test structure is solid. The main improvements needed are around test reliability and avoiding deprecated Android APIs.
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt
Outdated
Show resolved
Hide resolved
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
| android:icon="@mipmap/ic_launcher" | ||
| android:label="@string/app_name" | ||
| android:networkSecurityConfig="@xml/network_security_config" | ||
| android:requestLegacyExternalStorage="true" |
There was a problem hiding this comment.
Adding android:requestLegacyExternalStorage="true" is a backward compatibility flag for Android 10 that should be avoided for new features. Modern Android apps should use scoped storage (MediaStore API or Storage Access Framework).
Consider:
- Is this truly necessary for the feature, or can you use scoped storage APIs?
- If this is temporary, add a TODO comment with a plan to migrate to scoped storage
- Note that this flag has no effect on Android 11+ (API 30+)
There was a problem hiding this comment.
@tamaskozmer please check this if we really need to put this in.
There was a problem hiding this comment.
I think this is not a big issue, it does nothing from API level 30+. It can cause some changes on API level 29 or 28, which we still support, but wouldn't cause any issues. I still think that we shouldn't add Manifest properties solely for testing purposes, so if it is possible to overwrite this in the test Manifest (I think this is doable) than please change it to that.
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
📊 Code Coverage Report✅ Student
✅ Teacher
|
🧪 Unit Test Results✅ 📱 Parent App
✅ 📱 Teacher App
✅ 📦 Submodules
📊 Summary
Last updated: Thu, 05 Feb 2026 15:43:26 GMT |
refs: MBL-19679 affects: Parent release note:
.../src/main/kotlin/com/instructure/canvas/espresso/common/pages/compose/RecipientPickerPage.kt
Show resolved
Hide resolved
.../src/main/kotlin/com/instructure/canvas/espresso/common/pages/compose/RecipientPickerPage.kt
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Outdated
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Outdated
Show resolved
Hide resolved
apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/compose/InboxE2ETest.kt
Outdated
Show resolved
Hide resolved
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
apps/parent/src/androidTest/java/com/instructure/parentapp/ui/e2e/compose/InboxE2ETest.kt
Show resolved
Hide resolved
…achment-download-and-opening
| android:icon="@mipmap/ic_launcher" | ||
| android:label="@string/app_name" | ||
| android:networkSecurityConfig="@xml/network_security_config" | ||
| android:requestLegacyExternalStorage="true" |
There was a problem hiding this comment.
I think this is not a big issue, it does nothing from API level 30+. It can cause some changes on API level 29 or 28, which we still support, but wouldn't cause any issues. I still think that we shouldn't add Manifest properties solely for testing purposes, so if it is possible to overwrite this in the test Manifest (I think this is doable) than please change it to that.
…achment-download-and-opening
Summary
Add E2E tests for inbox message reply/forward with attachments (video, PDF) in Teacher and Parent apps.
refs: MBL-19679
affects: Teacher, Parent
release note:
Checklist