diff --git a/demo-app/build.gradle b/demo-app/build.gradle index 8d3f7c89..edda267f 100644 --- a/demo-app/build.gradle +++ b/demo-app/build.gradle @@ -45,7 +45,7 @@ android { versionName "1.0" multiDexEnabled true - testInstrumentationRunner "com.personalization.demo.DemoTestRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // Add shop ID to BuildConfig buildConfigField "String", "SHOP_ID", "\"${shopId}\"" @@ -131,7 +131,5 @@ dependencies { } testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } diff --git a/demo-app/src/androidTest/java/com/personalization/demo/CatalogReadIntegrationTest.kt b/demo-app/src/androidTest/java/com/personalization/demo/CatalogReadIntegrationTest.kt deleted file mode 100644 index 2c2960dc..00000000 --- a/demo-app/src/androidTest/java/com/personalization/demo/CatalogReadIntegrationTest.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.personalization.demo - -import androidx.test.espresso.Espresso.onView -import androidx.test.espresso.action.ViewActions.click -import androidx.test.espresso.action.ViewActions.scrollTo -import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.ext.junit.rules.ActivityScenarioRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith - -/** - * On-device E2E for the catalog/profile read demo buttons. Launches [MainActivity] - * (real production Firebase + SDK init) and taps the buttons, exercising - * `profileManager.getProfile`, `productsManager.getProductCounters` and - * `categoryManager.getCategory` against the live REES46 API on the emulator. - * - * Mirrors [LoyaltyIntegrationTest]: asserts the real on-device code path runs without crashing. - */ -@RunWith(AndroidJUnit4::class) -class CatalogReadIntegrationTest { - - @get:Rule - val activityRule = ActivityScenarioRule(MainActivity::class.java) - - @Test - fun getProfile_tapButton_noCrash() { - onView(withId(R.id.btnGetProfile)).perform(scrollTo(), click()) - Thread.sleep(3000) - } - - @Test - fun getProductCounters_tapButton_noCrash() { - onView(withId(R.id.btnGetProductCounters)).perform(scrollTo(), click()) - Thread.sleep(3000) - } - - @Test - fun getCategory_tapButton_noCrash() { - onView(withId(R.id.btnGetCategory)).perform(scrollTo(), click()) - Thread.sleep(3000) - } - - @Test - fun getCollection_tapButton_noCrash() { - onView(withId(R.id.btnGetCollection)).perform(scrollTo(), click()) - Thread.sleep(3000) - } -} diff --git a/demo-app/src/androidTest/java/com/personalization/demo/CoreLiveE2ETest.kt b/demo-app/src/androidTest/java/com/personalization/demo/CoreLiveE2ETest.kt deleted file mode 100644 index 5eb3383b..00000000 --- a/demo-app/src/androidTest/java/com/personalization/demo/CoreLiveE2ETest.kt +++ /dev/null @@ -1,428 +0,0 @@ -package com.personalization.demo - -import android.content.Context -import android.net.ConnectivityManager -import android.net.NetworkCapabilities -import android.os.ParcelFileDescriptor -import android.util.Log -import androidx.test.core.app.ActivityScenario -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import com.personalization.LogLevel -import com.personalization.Rees46 -import com.personalization.Rees46Config -import com.personalization.SDK -import com.personalization.SdkLogHandler -import com.personalization.SdkLogMessage -import com.personalization.api.OnApiCallbackListener -import com.personalization.api.models.purchase.PurchaseItemRequest -import com.personalization.api.models.purchase.PurchaseTrackingRequest -import com.personalization.api.models.tracking.TrackingItem -import com.personalization.core.SdkResult -import com.personalization.core.SdkState -import java.io.File -import java.util.concurrent.CopyOnWriteArrayList -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit -import org.json.JSONArray -import org.json.JSONObject -import org.junit.After -import org.junit.Assert.assertEquals -import org.junit.Assert.assertNotNull -import org.junit.Assert.assertTrue -import org.junit.Assume.assumeTrue -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith - -/** - * Live end-to-end check of the SDK's cores against the real API and the demo shop. - * - * A process has one core, decided by its first initialization, and [DemoApplication] initializes the - * demo shop itself; so these tests run only in a process the application left alone - * (`cleanProcess=true`, see [DemoTestRunner]), one core per run, and each is selected by its own - * argument. Without them every test here is skipped. - * - * [roundTrip], with `coreV2=true` or `coreV2=false`: a fresh install initializes the demo shop, runs a - * live search, tracks a product view, an add to cart, a purchase and a custom event, and checks that - * every request got a `2xx`: - * ``` - * ./gradlew :demo-app:connectedRees46DebugAndroidTest \ - * -Pandroid.testInstrumentationRunnerArguments.class=com.personalization.demo.CoreLiveE2ETest \ - * -Pandroid.testInstrumentationRunnerArguments.cleanProcess=true \ - * -Pandroid.testInstrumentationRunnerArguments.coreV2=true - * ``` - * - * The new core's queue across a restart without a network, in two runs of `am instrument` (the end of - * a run kills the process; the network stays off between them): - * - `offlineStep=1` ([offlineRestart1_queueWithoutNetwork]): initializes online, turns the network - * off, tracks a purchase and a custom event, and checks they wait on disk; - * - `offlineStep=2` ([offlineRestart2_deliverAfterRestart]): a new process initializes offline on the - * stored `did`, turns the network on, and checks that the queue goes without a flush. - * ``` - * adb shell am instrument -w -e cleanProcess true -e offlineStep 1 \ - * -e class com.personalization.demo.CoreLiveE2ETest \ - * com.personalization.demo.test/com.personalization.demo.DemoTestRunner - * ``` - * - * Every purchase is a real order of the demo shop, named `sdk-core-e2e--