diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 520baa1342..d9d9f889ab 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -105,19 +105,21 @@ dependencies { kspTest(libs.hilt.compiler) testImplementation(projects.core.dataTest) - testImplementation(projects.core.testing) testImplementation(libs.accompanist.testharness) testImplementation(libs.hilt.android.testing) testImplementation(libs.work.testing) testDemoImplementation(libs.robolectric) - testDemoImplementation(libs.roborazzi) + testDemoImplementation(projects.roborazzi) + androidTestImplementation(kotlin("test")) androidTestImplementation(projects.core.testing) androidTestImplementation(projects.core.dataTest) androidTestImplementation(projects.core.datastoreTest) + androidTestImplementation(libs.androidx.test.espresso.core) androidTestImplementation(libs.androidx.navigation.testing) androidTestImplementation(libs.accompanist.testharness) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(libs.hilt.android.testing) baselineProfile(projects.benchmarks) diff --git a/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt b/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt index f7345f04fa..3b62e03e18 100644 --- a/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt +++ b/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppScreenSizesScreenshotTests.kt @@ -38,7 +38,7 @@ import com.google.samples.apps.nowinandroid.core.data.repository.UserDataReposit import com.google.samples.apps.nowinandroid.core.data.repository.UserNewsResourceRepository import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions import com.google.samples.apps.nowinandroid.uitesthiltmanifest.HiltComponentActivity import dagger.hilt.android.testing.BindValue import dagger.hilt.android.testing.HiltAndroidRule diff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt index b8699a05dd..0e09860e69 100644 --- a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt @@ -30,10 +30,6 @@ class AndroidFeatureConventionPlugin : Plugin { apply("nowinandroid.android.hilt") } extensions.configure { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } configureGradleManagedDevices(this) } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index d442d94efd..cb7d4e2f1e 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -40,6 +40,7 @@ class AndroidLibraryConventionPlugin : Plugin { extensions.configure { configureKotlinAndroid(this) defaultConfig.targetSdk = 34 + defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" configureFlavors(this) configureGradleManagedDevices(this) // The resource prefix is derived from the module name, @@ -51,6 +52,7 @@ class AndroidLibraryConventionPlugin : Plugin { disableUnnecessaryAndroidTests(target) } dependencies { + add("androidTestImplementation", kotlin("test")) add("testImplementation", kotlin("test")) add("implementation", libs.findLibrary("androidx.tracing.ktx").get()) diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts index 4a6bcb66af..a9e38ead7d 100644 --- a/core/database/build.gradle.kts +++ b/core/database/build.gradle.kts @@ -22,10 +22,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.database" } @@ -34,5 +30,7 @@ dependencies { implementation(libs.kotlinx.datetime) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.kotlinx.coroutines.test) } diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index d68117d06c..5f08741db3 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -21,9 +21,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.designsystem" } @@ -46,9 +43,7 @@ dependencies { testImplementation(libs.accompanist.testharness) testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) - testImplementation(libs.roborazzi) - testImplementation(projects.core.testing) + testImplementation(projects.roborazzi) - androidTestImplementation(libs.androidx.compose.ui.test) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/BackgroundScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/BackgroundScreenshotTests.kt index e8cfd9a96b..b61a5a50aa 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/BackgroundScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/BackgroundScreenshotTests.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.unit.dp import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaBackground import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaGradientBackground -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ButtonScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ButtonScreenshotTests.kt index 2f6ab5370a..8b5f313911 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ButtonScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/ButtonScreenshotTests.kt @@ -24,7 +24,7 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaOutlinedButton import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/FilterChipScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/FilterChipScreenshotTests.kt index 2c9bc91ec1..a664d3a4b4 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/FilterChipScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/FilterChipScreenshotTests.kt @@ -30,8 +30,8 @@ import com.google.accompanist.testharness.TestHarness import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaBackground import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaFilterChip import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/IconButtonScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/IconButtonScreenshotTests.kt index 0104cfd476..d44c8f4cf7 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/IconButtonScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/IconButtonScreenshotTests.kt @@ -23,7 +23,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.test.junit4.createAndroidComposeRule import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaIconToggleButton import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/LoadingWheelScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/LoadingWheelScreenshotTests.kt index 9f80d04e5b..18c670bb08 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/LoadingWheelScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/LoadingWheelScreenshotTests.kt @@ -24,8 +24,8 @@ import com.github.takahirom.roborazzi.captureRoboImage import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaLoadingWheel import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaOverlayLoadingWheel import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/NavigationScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/NavigationScreenshotTests.kt index e2e92b5703..d0c88dceff 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/NavigationScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/NavigationScreenshotTests.kt @@ -31,8 +31,8 @@ import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavig import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaNavigationBarItem import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TabsScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TabsScreenshotTests.kt index 9190d5f354..d6a8c977d1 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TabsScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TabsScreenshotTests.kt @@ -29,8 +29,8 @@ import com.google.accompanist.testharness.TestHarness import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaTab import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaTabRow import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TagScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TagScreenshotTests.kt index d9edfd6c6f..50629add28 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TagScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TagScreenshotTests.kt @@ -26,8 +26,8 @@ import com.github.takahirom.roborazzi.captureRoboImage import com.google.accompanist.testharness.TestHarness import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaTopicTag import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TopAppBarScreenshotTests.kt b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TopAppBarScreenshotTests.kt index 6fac015629..bf79a29e74 100644 --- a/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TopAppBarScreenshotTests.kt +++ b/core/designsystem/src/test/kotlin/com/google/samples/apps/nowinandroid/core/designsystem/TopAppBarScreenshotTests.kt @@ -29,8 +29,8 @@ import com.google.accompanist.testharness.TestHarness import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaTopAppBar import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultRoborazziOptions -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiTheme +import com.google.samples.apps.nowinandroid.roborazzi.DefaultRoborazziOptions +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiTheme import dagger.hilt.android.testing.HiltTestApplication import org.junit.Rule import org.junit.Test diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts index 275555d809..448eca0e81 100644 --- a/core/testing/build.gradle.kts +++ b/core/testing/build.gradle.kts @@ -15,7 +15,6 @@ */ plugins { alias(libs.plugins.nowinandroid.android.library) - alias(libs.plugins.nowinandroid.android.library.compose) alias(libs.plugins.nowinandroid.android.hilt) } @@ -24,23 +23,15 @@ android { } dependencies { - api(kotlin("test")) - api(libs.androidx.compose.ui.test) - api(libs.roborazzi) + api(libs.kotlinx.coroutines.test) + api(projects.core.analytics) + api(projects.core.common) api(projects.core.data) api(projects.core.model) api(projects.core.notifications) - debugApi(libs.androidx.compose.ui.testManifest) - - implementation(libs.accompanist.testharness) - implementation(libs.androidx.activity.compose) implementation(libs.androidx.test.rules) implementation(libs.hilt.android.testing) - implementation(libs.kotlinx.coroutines.test) implementation(libs.kotlinx.datetime) - implementation(libs.robolectric.shadows) - implementation(projects.core.common) - implementation(projects.core.designsystem) } diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 5d8a65d449..5606cb5d16 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -20,9 +20,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.ui" } @@ -36,5 +33,6 @@ dependencies { implementation(libs.coil.kt) implementation(libs.coil.kt.compose) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/bookmarks/build.gradle.kts b/feature/bookmarks/build.gradle.kts index 4e97176a2c..51a15ce7a0 100644 --- a/feature/bookmarks/build.gradle.kts +++ b/feature/bookmarks/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/foryou/build.gradle.kts b/feature/foryou/build.gradle.kts index da0a7ec5b8..416825637a 100644 --- a/feature/foryou/build.gradle.kts +++ b/feature/foryou/build.gradle.kts @@ -33,7 +33,9 @@ dependencies { testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) testImplementation(projects.core.testing) - testDemoImplementation(libs.roborazzi) + testDemoImplementation(projects.roborazzi) + + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenScreenshotTests.kt b/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenScreenshotTests.kt index 14b67c64e5..9b029818f7 100644 --- a/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenScreenshotTests.kt +++ b/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenScreenshotTests.kt @@ -21,15 +21,15 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.test.junit4.createAndroidComposeRule import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaBackground import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme -import com.google.samples.apps.nowinandroid.core.testing.util.DefaultTestDevices -import com.google.samples.apps.nowinandroid.core.testing.util.captureForDevice -import com.google.samples.apps.nowinandroid.core.testing.util.captureMultiDevice import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState.Success import com.google.samples.apps.nowinandroid.core.ui.UserNewsResourcePreviewParameterProvider import com.google.samples.apps.nowinandroid.feature.foryou.OnboardingUiState.Loading import com.google.samples.apps.nowinandroid.feature.foryou.OnboardingUiState.NotShown import com.google.samples.apps.nowinandroid.feature.foryou.OnboardingUiState.Shown +import com.google.samples.apps.nowinandroid.roborazzi.DefaultTestDevices +import com.google.samples.apps.nowinandroid.roborazzi.captureForDevice +import com.google.samples.apps.nowinandroid.roborazzi.captureMultiDevice import dagger.hilt.android.testing.HiltTestApplication import org.junit.Before import org.junit.Rule diff --git a/feature/interests/build.gradle.kts b/feature/interests/build.gradle.kts index f0bca97298..04089f1337 100644 --- a/feature/interests/build.gradle.kts +++ b/feature/interests/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } \ No newline at end of file diff --git a/feature/search/build.gradle.kts b/feature/search/build.gradle.kts index 206f4c0f92..2a42d44c36 100644 --- a/feature/search/build.gradle.kts +++ b/feature/search/build.gradle.kts @@ -33,6 +33,7 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index 4b9a72bdd0..15d65204dc 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -31,5 +31,5 @@ dependencies { testImplementation(projects.core.testing) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/feature/topic/build.gradle.kts b/feature/topic/build.gradle.kts index d457b2f732..726920af17 100644 --- a/feature/topic/build.gradle.kts +++ b/feature/topic/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7e0380cabb..eb057344b1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -57,6 +57,9 @@ secrets = "2.0.1" truth = "1.1.5" turbine = "1.0.0" +[bundles] +androidx-compose-ui-test = ["androidx-compose-ui-test", "androidx-compose-ui-testManifest"] + [libraries] accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } accompanist-testharness = { group = "com.google.accompanist", name = "accompanist-testharness", version.ref = "accompanist" } diff --git a/roborazzi/.gitignore b/roborazzi/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/roborazzi/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/roborazzi/build.gradle.kts b/roborazzi/build.gradle.kts new file mode 100644 index 0000000000..1c6db932a0 --- /dev/null +++ b/roborazzi/build.gradle.kts @@ -0,0 +1,33 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +plugins { + alias(libs.plugins.nowinandroid.android.library) + alias(libs.plugins.nowinandroid.android.library.compose) +} + +android { + namespace = "com.google.samples.apps.nowinandroid.roborazzi" +} + +dependencies { + api(libs.androidx.activity.compose) + api(libs.bundles.androidx.compose.ui.test) + api(libs.roborazzi) + api(libs.robolectric.shadows) + + implementation(libs.accompanist.testharness) + implementation(projects.core.designsystem) +} diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt b/roborazzi/src/main/kotlin/com/google/samples/apps/nowinandroid/roborazzi/ScreenshotHelper.kt similarity index 99% rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt rename to roborazzi/src/main/kotlin/com/google/samples/apps/nowinandroid/roborazzi/ScreenshotHelper.kt index 468fff8dfb..8d1e3364e0 100644 --- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt +++ b/roborazzi/src/main/kotlin/com/google/samples/apps/nowinandroid/roborazzi/ScreenshotHelper.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.samples.apps.nowinandroid.core.testing.util +package com.google.samples.apps.nowinandroid.roborazzi import androidx.activity.ComponentActivity import androidx.activity.compose.setContent diff --git a/settings.gradle.kts b/settings.gradle.kts index fa043c955a..55057d5575 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -59,6 +59,7 @@ include(":feature:topic") include(":feature:search") include(":feature:settings") include(":lint") +include(":roborazzi") include(":sync:work") include(":sync:sync-test") include(":ui-test-hilt-manifest") diff --git a/sync/work/build.gradle.kts b/sync/work/build.gradle.kts index 7e61c73898..eb726a48d6 100644 --- a/sync/work/build.gradle.kts +++ b/sync/work/build.gradle.kts @@ -38,8 +38,8 @@ dependencies { prodImplementation(libs.firebase.cloud.messaging) prodImplementation(platform(libs.firebase.bom)) + androidTestImplementation(projects.core.testing) androidTestImplementation(libs.androidx.work.testing) androidTestImplementation(libs.hilt.android.testing) androidTestImplementation(libs.kotlinx.coroutines.guava) - androidTestImplementation(projects.core.testing) }