[ALFMOB-341] Add BFF integration test suite (productList, productDetails, searchProducts)#24
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new :integration-test Android library module containing instrumented integration tests that exercise the new BFF GraphQL operations (productList, productDetails, searchProducts) against a locally-running backend (emulator host alias 10.0.2.2). This fits the ongoing BFF migration by validating server responses and pagination behavior with a real ApolloClient, while keeping unit-test lanes unaffected.
Changes:
- Introduces the
:integration-testmodule with a JUnit5 instrumented test suite (reachability-gated viaassumeTrue). - Adds test-only manifest + network security config to allow
INTERNET+ cleartext to10.0.2.2. - Updates docs and aligns PLP placeholder collection handle to
frontpage.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Includes the new :integration-test module in the Gradle build. |
| README.md | Documents how to run the local-BFF integration tests and where reports are generated. |
| integration-test/build.gradle.kts | Declares the new module and its androidTest-only dependencies. |
| integration-test/src/main/AndroidManifest.xml | Provides a minimal manifest for the new library module. |
| integration-test/src/androidTest/AndroidManifest.xml | Adds INTERNET permission and points to a test-only network security config. |
| integration-test/src/androidTest/res/xml/network_security_config.xml | Allows cleartext traffic to 10.0.2.2 for emulator → host BFF access. |
| integration-test/src/androidTest/java/com/mindera/alfie/integrationtest/BffIntegrationTest.kt | Adds a shared base with BFF reachability gating + Apollo execution helpers. |
| integration-test/src/androidTest/java/com/mindera/alfie/integrationtest/ProductListIntegrationTest.kt | Validates productList happy path, pagination, sorting, and brand filtering. |
| integration-test/src/androidTest/java/com/mindera/alfie/integrationtest/ProductDetailsIntegrationTest.kt | Validates productDetails shape and variant/options consistency. |
| integration-test/src/androidTest/java/com/mindera/alfie/integrationtest/SearchProductsIntegrationTest.kt | Validates searchProducts happy path and cursor pagination. |
| feature/plp/src/main/java/com/mindera/alfie/feature/plp/ProductListViewModel.kt | Switches the BFF placeholder collection handle to frontpage. |
…ig; drop redundant apollo dep
|
|
||
| val prices = response.products.map { | ||
| it.productListEntryFragment.priceRange.minVariantPrice.moneyFragment.amount | ||
| } |
There was a problem hiding this comment.
amount is a String from the GraphQL schema — .sorted() on a List<String> sorts lexicographically, not numerically. Prices like "9.99" and "10.00" will be misordered ('9' > '1'), so the test gives a false green whenever prices span a power-of-ten boundary.
val prices = response.products.map {
it.productListEntryFragment.priceRange.minVariantPrice.moneyFragment.amount.toBigDecimal()
}
assertEquals(prices.sorted(), prices, "PRICE_ASC should return non-decreasing min prices")
ALFMOB-341 — Integration test suite against local BFF
Adds a new
:integration-testAndroid library module with instrumented tests that drive a realApolloClientagainst a locally-running BFF, exercising the operations introduced in the BFF-migration epic.Coverage
PRICE_ASCordering, brand filter.options[]consistency.Tests are data-driven (handles/terms are read from
productListfor thefrontpagecollection) so they tolerate changing BFF data, and assert on shape rather than exact values.How it runs
./gradlew :integration-test:connectedDebugAndroidTest(an emulator + a BFF on:3000). Not part oftestDebugUnitTest, so PR unit lanes are unaffected.assumeTrue) skips — not fails — when no BFF is reachable, so the suite stays green on devices/CI without a backend.INTERNETpermission + a cleartext allowance for10.0.2.2(added via theandroidTestmanifest); these are otherwise only present in:app.Verification
Ran on a
Pixel_10_Proemulator against the live local BFF: 7 tests, 0 failures, 0 skipped. detekt clean.Docs / follow-ups