Bug 1807268 - Re-enable verifyShowClipboardSuggestionsToggleTest UI test r=jajohnson
[gecko.git] / mobile / android / fenix / app / src / androidTest / java / org / mozilla / fenix / ui / NimbusEventTest.kt
blob943e0624c85695860caaefb0a0ceb11d99df413b
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix.ui
7 import android.content.Intent
8 import io.mockk.mockk
9 import mozilla.components.concept.sync.AuthType
10 import mozilla.components.service.fxa.FirefoxAccount
11 import org.junit.Assert.assertTrue
12 import org.junit.Rule
13 import org.junit.Test
14 import org.mozilla.fenix.components.TelemetryAccountObserver
15 import org.mozilla.fenix.helpers.Experimentation
16 import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
17 import org.mozilla.fenix.helpers.RetryTestRule
18 import org.mozilla.fenix.helpers.TestHelper.appContext
19 import org.mozilla.fenix.helpers.TestSetup
21 class NimbusEventTest : TestSetup() {
22     @get:Rule
23     val homeActivityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
24         .withIntent(
25             Intent().apply {
26                 action = Intent.ACTION_VIEW
27             },
28         )
30     @Rule
31     @JvmField
32     val retryTestRule = RetryTestRule(3)
34     @Test
35     fun homeScreenNimbusEventsTest() {
36         Experimentation.withHelper {
37             assertTrue(evalJexl("'app_opened'|eventSum('Days', 28, 0) > 0"))
38         }
39     }
41     @Test
42     fun telemetryAccountObserverTest() {
43         val observer = TelemetryAccountObserver(appContext)
44         // replacing interface mock with implementation mock.
45         observer.onAuthenticated(mockk<FirefoxAccount>(), AuthType.Signin)
47         Experimentation.withHelper {
48             assertTrue(evalJexl("'sync_auth.sign_in'|eventSum('Days', 28, 0) > 0"))
49         }
50     }