Skip to content

Commit e3c7018

Browse files
committed
Extract ScreenshotHelper to separate testing module
Change-Id: Icf98a4acc9963656530a1a9fc8b156a553a070af
1 parent 9cd430b commit e3c7018

File tree

10 files changed

+60
-8
lines changed

10 files changed

+60
-8
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ dependencies {
113113

114114
testDemoImplementation(libs.robolectric)
115115
testDemoImplementation(libs.roborazzi)
116+
testDemoImplementation(projects.core.screenshotTesting)
116117

117118
androidTestImplementation(projects.core.testing)
118119
androidTestImplementation(projects.core.dataTest)
119120
androidTestImplementation(projects.core.datastoreTest)
121+
androidTestImplementation(libs.androidx.test.espresso.core)
120122
androidTestImplementation(libs.androidx.navigation.testing)
121123
androidTestImplementation(libs.accompanist.testharness)
122124
androidTestImplementation(libs.hilt.android.testing)

core/designsystem/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies {
4747
testImplementation(libs.hilt.android.testing)
4848
testImplementation(libs.robolectric)
4949
testImplementation(libs.roborazzi)
50+
testImplementation(projects.core.screenshotTesting)
5051
testImplementation(projects.core.testing)
5152

5253
androidTestImplementation(libs.androidx.compose.ui.test)

core/screenshot-testing/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2022 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
plugins {
17+
alias(libs.plugins.nowinandroid.android.library)
18+
alias(libs.plugins.nowinandroid.android.library.compose)
19+
alias(libs.plugins.nowinandroid.android.hilt)
20+
}
21+
22+
android {
23+
namespace = "com.google.samples.apps.nowinandroid.core.screenshottesting"
24+
}
25+
26+
dependencies {
27+
api(libs.roborazzi)
28+
implementation(libs.accompanist.testharness)
29+
implementation(libs.androidx.activity.compose)
30+
implementation(libs.androidx.compose.ui.test)
31+
implementation(libs.robolectric)
32+
implementation(projects.core.common)
33+
implementation(projects.core.designsystem)
34+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2022 The Android Open Source Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<manifest />

core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt renamed to core/screenshot-testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt

File renamed without changes.

core/testing/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,17 @@ android {
2626
dependencies {
2727
api(kotlin("test"))
2828
api(libs.androidx.compose.ui.test)
29-
api(libs.roborazzi)
3029
api(projects.core.analytics)
3130
api(projects.core.data)
3231
api(projects.core.model)
3332
api(projects.core.notifications)
3433

3534
debugApi(libs.androidx.compose.ui.testManifest)
3635

37-
implementation(libs.accompanist.testharness)
38-
implementation(libs.androidx.activity.compose)
3936
implementation(libs.androidx.test.rules)
4037
implementation(libs.hilt.android.testing)
4138
implementation(libs.kotlinx.coroutines.test)
4239
implementation(libs.kotlinx.datetime)
43-
implementation(libs.robolectric.shadows)
4440
implementation(projects.core.common)
4541
implementation(projects.core.designsystem)
4642
}

feature/foryou/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies {
3333
testImplementation(libs.hilt.android.testing)
3434
testImplementation(libs.robolectric)
3535
testImplementation(projects.core.testing)
36+
testImplementation(projects.core.screenshotTesting)
3637
testDemoImplementation(libs.roborazzi)
3738

3839
androidTestImplementation(projects.core.testing)

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ protobuf-protoc = { group = "com.google.protobuf", name = "protoc", version.ref
128128
retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
129129
retrofit-kotlin-serialization = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "retrofitKotlinxSerializationJson" }
130130
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" }
131-
robolectric-shadows = { group = "org.robolectric", name = "shadows-framework", version.ref = "robolectric" }
132131
roborazzi = { group = "io.github.takahirom.roborazzi", name = "roborazzi", version.ref = "roborazzi" }
133132
room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
134133
room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }

settings.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
3636
include(":app")
3737
include(":app-nia-catalog")
3838
include(":benchmarks")
39+
include(":core:analytics")
3940
include(":core:common")
4041
include(":core:data")
4142
include(":core:data-test")
@@ -47,10 +48,10 @@ include(":core:designsystem")
4748
include(":core:domain")
4849
include(":core:model")
4950
include(":core:network")
50-
include(":core:ui")
51-
include(":core:testing")
52-
include(":core:analytics")
5351
include(":core:notifications")
52+
include(":core:screenshot-testing")
53+
include(":core:testing")
54+
include(":core:ui")
5455

5556
include(":feature:foryou")
5657
include(":feature:interests")

0 commit comments

Comments
 (0)