Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid running most complex tests in CI automatically. #304

Merged
merged 4 commits into from Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -26,12 +26,14 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.printToLog
import androidx.test.filters.MediumTest
import com.google.android.horologist.audio.ExperimentalHorologistAudioApi
import com.google.android.horologist.audio.VolumeState
import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalHorologistAudioApi::class, ExperimentalHorologistAudioUiApi::class)
@MediumTest
class VolumePositionIndicatorTest {
@get:Rule
val composeTestRule = createComposeRule().apply {
Expand Down
Expand Up @@ -22,13 +22,15 @@ import androidx.compose.ui.test.assertHasClickAction
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.test.filters.MediumTest
import com.google.android.horologist.audio.AudioOutput
import com.google.android.horologist.audio.VolumeState
import com.google.android.horologist.test.toolbox.matchers.assertHasClickLabel
import com.google.android.horologist.test.toolbox.matchers.assertHasStateDescription
import org.junit.Rule
import org.junit.Test

@MediumTest
class VolumeScreenA11yTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performRotaryScrollInput
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
import com.google.android.horologist.audio.ExperimentalHorologistAudioApi
import com.google.android.horologist.audio.VolumeState
Expand All @@ -35,7 +36,7 @@ import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalHorologistAudioApi::class, ExperimentalHorologistAudioUiApi::class, ExperimentalTestApi::class, kotlinx.coroutines.ExperimentalCoroutinesApi::class)

@MediumTest
class VolumeScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -25,12 +25,14 @@ import androidx.compose.material.icons.filled.VolumeUp
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.test.filters.MediumTest
import com.google.android.horologist.audio.VolumeState
import com.google.android.horologist.audio.ui.ExperimentalHorologistAudioUiApi
import com.google.android.horologist.test.toolbox.matchers.hasIconImageVector
import org.junit.Rule
import org.junit.Test

@MediumTest
class SetVolumeButtonTest {

@get:Rule
Expand Down
Expand Up @@ -17,6 +17,7 @@
package com.google.android.horologist.audio

import androidx.test.annotation.UiThreadTest
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.Dispatchers
Expand All @@ -29,6 +30,7 @@ import kotlinx.coroutines.withContext
import org.junit.Test

@OptIn(ExperimentalCoroutinesApi::class, ExperimentalHorologistAudioApi::class)
@MediumTest
class SystemAudioRepositoryTest {
@Test
@UiThreadTest
Expand Down
Expand Up @@ -23,13 +23,15 @@ import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.filters.MediumTest
import com.google.android.horologist.compose.navscaffold.ExperimentalHorologistComposeLayoutApi
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import kotlin.math.roundToInt

@OptIn(ExperimentalHorologistComposeLayoutApi::class)
@MediumTest
class FadeAwayTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -27,12 +27,14 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onRoot
import androidx.test.filters.MediumTest
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import kotlin.math.pow
import kotlin.math.sqrt

@MediumTest
class FillMaxRectangleTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -36,6 +36,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.get
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.test.filters.MediumTest
import androidx.wear.compose.foundation.curvedComposable
import androidx.wear.compose.material.AutoCenteringParams
import androidx.wear.compose.material.ScalingLazyColumn
Expand All @@ -53,6 +54,7 @@ import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalHorologistComposeLayoutApi::class)
@MediumTest
class NavScaffoldTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.lifecycle.whenResumed
import androidx.test.filters.MediumTest
import androidx.wear.compose.material.Text
import com.google.accompanist.pager.PagerState
import com.google.android.horologist.compose.navscaffold.ExperimentalHorologistComposeLayoutApi
Expand All @@ -43,6 +44,7 @@ import org.junit.Rule
import org.junit.Test

@OptIn(ExperimentalHorologistComposeLayoutApi::class)
@MediumTest
class PagerScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
Expand Down
Expand Up @@ -33,7 +33,6 @@ import androidx.compose.ui.test.onParent
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performSemanticsAction
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.filters.MediumTest
import com.google.android.horologist.compose.navscaffold.ExperimentalHorologistComposeLayoutApi
import com.google.common.truth.Truth
Expand All @@ -49,7 +48,6 @@ import org.junit.runner.RunWith

@MediumTest
@RunWith(AndroidJUnit4::class)
@LargeTest
@Ignore("https://github.com/google/horologist/issues/66")
class SnackbarHostTest {

Expand Down Expand Up @@ -112,7 +110,6 @@ class SnackbarHostTest {
}

@Test
@LargeTest
@Ignore("ComposeTimeoutException: Condition still not satisfied after 5000 ms")
fun snackbarHost_returnedResult() {
val hostState = SnackbarHostState()
Expand Down
Expand Up @@ -18,13 +18,15 @@ package com.google.android.horologist.mediasample

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.lifecycle.Lifecycle
import androidx.test.filters.LargeTest
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToLibrary
import com.google.android.horologist.media.ui.navigation.MediaNavController.navigateToVolume
import com.google.android.horologist.mediasample.components.MediaActivity
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

@LargeTest
class MediaActivityTest {
@get:Rule
var rule = createAndroidComposeRule<MediaActivity>()
Expand Down
Expand Up @@ -17,6 +17,7 @@
package com.google.android.horologist.mediasample.playback

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.google.android.horologist.media.data.Media3MediaItemMapper
import com.google.android.horologist.media.model.MediaItem
import com.google.common.truth.Truth.assertThat
Expand All @@ -28,6 +29,7 @@ import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
@LargeTest
class PlaybackErrorTest : BasePlaybackTest() {
@Test
fun testFailingItem() = runTest {
Expand Down
Expand Up @@ -19,6 +19,7 @@ package com.google.android.horologist.mediasample.playback
import android.app.Notification
import androidx.core.app.NotificationCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.google.android.horologist.media.data.Media3MediaItemMapper
import com.google.android.horologist.media3.flows.waitForPlaying
import com.google.common.truth.Truth.assertThat
Expand All @@ -31,6 +32,7 @@ import org.junit.runner.RunWith
import kotlin.time.Duration.Companion.seconds

@RunWith(AndroidJUnit4::class)
@LargeTest
class PlaybackNotificationTest : BasePlaybackTest() {
@Test
fun testCausesNotification() = runTest {
Expand Down
Expand Up @@ -17,6 +17,7 @@
package com.google.android.horologist.mediasample.playback

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.test.runTest
Expand All @@ -25,6 +26,7 @@ import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
@LargeTest
class PlaybackServiceTest : BasePlaybackTest() {
@Test
fun testMediaBrowser() = runTest {
Expand Down
4 changes: 4 additions & 0 deletions media-ui/build.gradle
Expand Up @@ -126,6 +126,10 @@ dependencies {

androidTestImplementation libs.compose.ui.test.junit4
androidTestImplementation libs.truth
androidTestImplementation libs.espresso.core
androidTestImplementation libs.junit
androidTestImplementation libs.androidx.test.ext
androidTestImplementation libs.androidx.test.ext.ktx
}

apply plugin: "com.vanniktech.maven.publish"
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.performClick
import androidx.test.filters.LargeTest
import androidx.wear.compose.material.Text
import com.google.android.horologist.media.model.Command
import com.google.android.horologist.media.model.MediaItem
Expand All @@ -39,6 +40,7 @@ import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test

@LargeTest
class PlayerScreenTest {

@get:Rule
Expand Down
4 changes: 4 additions & 0 deletions network-awareness/build.gradle
Expand Up @@ -99,6 +99,10 @@ dependencies {
testImplementation libs.junit

androidTestImplementation libs.compose.ui.test.junit4
androidTestImplementation libs.espresso.core
androidTestImplementation libs.junit
androidTestImplementation libs.androidx.test.ext
androidTestImplementation libs.androidx.test.ext.ktx
androidTestImplementation libs.truth
}

Expand Down
Expand Up @@ -21,6 +21,7 @@ package com.google.android.horologist.networks
import android.content.Context
import android.net.ConnectivityManager
import androidx.activity.ComponentActivity
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
import com.google.android.horologist.networks.logging.NetworkStatusLogger
import com.google.android.horologist.networks.status.NetworkRepository
Expand All @@ -36,6 +37,7 @@ import org.junit.After
import org.junit.Before
import org.junit.Test

@MediumTest
class NetworkRepositoryTest {
private lateinit var networkRepository: NetworkRepository
private lateinit var context: Context
Expand Down
Expand Up @@ -18,11 +18,13 @@ package com.google.android.horologist.navscaffold

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.lifecycle.Lifecycle
import androidx.test.filters.LargeTest
import com.google.android.horologist.navsample.NavActivity
import com.google.android.horologist.navsample.NavScreen
import org.junit.Rule
import org.junit.Test

@LargeTest
class NavActivityTest {
@get:Rule
var rule = createAndroidComposeRule<NavActivity>()
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-tests.sh
Expand Up @@ -106,4 +106,4 @@ if [ "$SHARD_COUNT" -gt "0" ]; then
SHARD_OPTS="$SHARD_OPTS -Pandroid.testInstrumentationRunnerArguments.shardIndex=$SHARD_INDEX"
fi

./gradlew --scan --continue --no-configuration-cache --stacktrace $TASK $FILTER_OPTS $SHARD_OPTS
./gradlew --scan --continue --no-configuration-cache --stacktrace $TASK $FILTER_OPTS $SHARD_OPTS -Pandroid.testInstrumentationRunnerArguments.size=small,medium
luizgrp marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -19,6 +19,7 @@
package com.google.android.horologist.tiles

import android.content.Context
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.wear.tiles.ResourceBuilders
import com.google.android.horologist.tiles.images.loadImageResource
Expand All @@ -28,6 +29,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test

@SmallTest
class ImagesTest {
private lateinit var context: Context

Expand Down