Fix broken unit tests in French caption detection PR
Description (required)
Fixes broken unit tests for PR #6553.
This PR addresses CI failures blocking #6553 (French caption detection feature):
Manifest merger conflict
Test builds failed due to appComponentFactory attribute conflict between main and test manifests. Added explicit override in app/src/test/AndroidManifest.xml:
<application
tools:replace="android:appComponentFactory"
android:appComponentFactory="androidx.core.app.CoreComponentFactory" />
Invalid test index fix
UploadActivityUnitTests.testOnNextButtonClicked was calling onNextButtonClicked(-1) with an invalid index, causing an IndexOutOfBoundsException. Fixed the test to use a valid index 0 instead.
Tests performed (required)
All 1536 unit tests passing on ProdDebug and BetaDebug variants.
./gradlew testProdDebugUnitTest # 1536 tests, 100% pass
./gradlew testBetaDebugUnitTest # 1536 tests, 100% pass
Screenshots (for UI changes only)
N/A - test infrastructure changes only
Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.
Original prompt
Create a PR against this one: https://github.com/commons-app/apps-android-commons/pull/6553. Fix the broken unit tests and maybe even implement the possible TODOs in the PR description. There's already a PR for kotlin 2.1.0 migration, so skip that TODO. Make sure all the unit tests pass before you commit your changes
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
@copilot are the changes in UploadActivity.kt really necessary? If not, remove and re-run the tests and fix any remaining issues.
@copilot are the changes in UploadActivity.kt really necessary? If not, remove and re-run the tests and fix any remaining issues.
You're right - the UploadActivity.kt changes weren't necessary. The root cause was the test testOnNextButtonClicked() passing an invalid index -1. I've reverted all UploadActivity.kt changes and fixed the test to use a valid index 0 instead. All 1536 tests pass. See commit 7138e02.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
commons.wikimedia.org
- Triggering command:
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Djava.awt.headless=true -Djava.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib:/home/REDACTED/work/apps-android-commons/apps-android-commons/app/src/testProdDebug/jniLibs:/home/REDACTED/work/apps-android-commons/apps-android-commons/app/src/testDebug/jniLibs:/hom(dns block)example.com
- Triggering command:
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Djava.awt.headless=true -Djava.library.path=/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib:/home/REDACTED/work/apps-android-commons/apps-android-commons/app/src/testProdDebug/jniLibs:/home/REDACTED/work/apps-android-commons/apps-android-commons/app/src/testDebug/jniLibs:/hom(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)