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
9 import mozilla.components.concept.sync.AuthType
10 import mozilla.components.service.fxa.FirefoxAccount
11 import org.junit.Assert.assertTrue
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() {
23 val homeActivityTestRule = HomeActivityIntentTestRule.withDefaultSettingsOverrides()
26 action = Intent.ACTION_VIEW
32 val retryTestRule = RetryTestRule(3)
35 fun homeScreenNimbusEventsTest() {
36 Experimentation.withHelper {
37 assertTrue(evalJexl("'app_opened'|eventSum('Days', 28, 0) > 0"))
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"))