From a119afcbecdaa2aea81a9440e9164f27c5cb5d8e Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 13 Sep 2021 22:45:09 -0700 Subject: Separate and fix activity tests --- .../frost/activities/ActivityConstructionTest.kt | 158 --------------------- 1 file changed, 158 deletions(-) delete mode 100644 app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ActivityConstructionTest.kt (limited to 'app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ActivityConstructionTest.kt') diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ActivityConstructionTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ActivityConstructionTest.kt deleted file mode 100644 index 22e6cbab..00000000 --- a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ActivityConstructionTest.kt +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2021 Allan Wang - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.pitchedapps.frost.activities - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.test.core.app.ActivityScenario -import com.pitchedapps.frost.StartActivity -import com.pitchedapps.frost.utils.ARG_IMAGE_URL -import com.pitchedapps.frost.utils.ARG_URL -import dagger.hilt.android.qualifiers.ApplicationContext -import dagger.hilt.android.testing.HiltAndroidRule -import dagger.hilt.android.testing.HiltAndroidTest -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import javax.inject.Inject - -/** - * Basic activity launching tests. - * - * Verifies that Hilt injections are not used prior to onCreate - */ -@HiltAndroidTest -class ActivityConstructionTest { - - @ApplicationContext - @Inject - lateinit var appContext: Context - - @get:Rule - val hiltRule = HiltAndroidRule(this) - - @Before - fun before() { - hiltRule.inject() - } - - @Test - fun aboutActivity() { - launch() - } - - @Test - fun debugActivity() { - launch() - } - - @Test - fun frostWebActivity() { - launch( - intentAction = { - putExtra(ARG_URL, FORMATTED_URL) - } - ) - } - - @Test - fun imageActivity() { - launch( - intentAction = { - putExtra(ARG_IMAGE_URL, FORMATTED_URL) - } - ) - } - - @Test - @Ignore("Doesn't work, yet production is fine.") - fun introActivity() { - launch() - } - - @Test - fun loginActivity() { - launch() - } - - @Test - fun mainActivity() { - launch() - } - - @Test - fun selectorActivity() { - launch() - } - - @Test - fun settingsActivity() { - launch() - } - - @Test - fun startActivity() { - launch() - } - - @Test - fun tabCustomizerActivity() { - launch() - } - - @Test - fun webOverlayMobileActivity() { - launch( - intentAction = { - putExtra(ARG_URL, FORMATTED_URL) - } - ) - } - - @Test - fun webOverlayDesktopActivity() { - launch( - intentAction = { - putExtra(ARG_URL, FORMATTED_URL) - } - ) - } - - @Test - fun webOverlayActivity() { - launch( - intentAction = { - putExtra(ARG_URL, FORMATTED_URL) - } - ) - } - - private inline fun launch( - intentAction: Intent.() -> Unit = {}, - activityOptions: Bundle? = null - ): ActivityScenario { - val intent = Intent(appContext, A::class.java).also(intentAction) - return ActivityScenario.launch(intent, activityOptions) - } - - private companion object { - const val FORMATTED_URL = "https://www.google.com" - } -} -- cgit v1.2.3