Fixes #27933: record app opened event and add nimbus event test suite
parent
11efaff96c
commit
f709036636
@ -0,0 +1,51 @@
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import org.junit.*
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
|
||||
import org.mozilla.fenix.helpers.RetryTestRule
|
||||
import org.mozilla.fenix.ui.robots.homeScreen
|
||||
|
||||
class NimbusEventTest {
|
||||
private lateinit var mDevice: UiDevice
|
||||
private lateinit var mockWebServer: MockWebServer
|
||||
|
||||
@get:Rule
|
||||
val activityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
|
||||
.withIntent(Intent().apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
})
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
val retryTestRule = RetryTestRule(3)
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
|
||||
mockWebServer = MockWebServer().apply {
|
||||
dispatcher = AndroidAssetDispatcher()
|
||||
start()
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun homeScreenNimbusEventsTest() {
|
||||
homeScreen { }.dismissOnboarding()
|
||||
|
||||
homeScreen {
|
||||
verifyHomeScreen()
|
||||
Assert.assertTrue(evaluateAgainstNimbusTargetingHelper("'app_opened'|eventSum('Days', 28, 0) > 0"))
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue