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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try roborazzi #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions JetNews/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
id("io.github.takahirom.roborazzi") version "1.3.0-alpha-4"
}

android {
Expand Down Expand Up @@ -147,6 +148,7 @@ dependencies {
// Robolectric dependencies
testImplementation(libs.androidx.compose.ui.test.junit4)
testImplementation(libs.robolectric)
testImplementation("io.github.takahirom.roborazzi:roborazzi:1.3.0-alpha-4")
}

tasks.withType<Test>().configureEach {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ val florina = PostAuthor(
val jose =
PostAuthor("Jose Alcérreca", "https://medium.com/@JoseAlcerreca")

val takahirom =
PostAuthor("takahirom", "https://github.com/takahirom")

val publication = Publication(
"Android Developers",
"https://cdn-images-1.medium.com/max/258/1*[email protected]"
Expand Down Expand Up @@ -982,6 +985,22 @@ val post3 = Post(
imageThumbId = R.drawable.post_3_thumb
)

val roborazziPost = Post(
id = "84eb677660d1",
title = "Hello from Roborazzi",
subtitle = "Roborazzi makes Android App test automation easy.",
url = "https://medium.com/androiddevelopers/locale-changes-and-the-androidviewmodel-antipattern-84eb677660d9",
publication = publication,
metadata = Metadata(
author = takahirom,
date = "June 18",
readTimeMinutes = 1
),
paragraphs = paragraphsPost4,
imageId = R.drawable.post_4,
imageThumbId = R.drawable.post_4_thumb
)

val post4 = Post(
id = "84eb677660d9",
title = "Locale changes and the AndroidViewModel antipattern",
Expand Down Expand Up @@ -1016,7 +1035,7 @@ val post5 = Post(

val posts: PostsFeed =
PostsFeed(
highlightedPost = post4,
highlightedPost = roborazziPost,
recommendedPosts = listOf(post1, post2, post3),
popularPosts = listOf(
post5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.printToString
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.github.takahirom.roborazzi.captureRoboImage
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.annotation.GraphicsMode

@RunWith(AndroidJUnit4::class)
class JetnewsTests {
Expand All @@ -46,12 +48,15 @@ class JetnewsTests {
composeTestRule.onNodeWithText("Top stories for you").assertExists()
}

@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Test
fun app_opensArticle() {

println(composeTestRule.onRoot().printToString())
composeTestRule.onRoot().captureRoboImage()
composeTestRule.onNodeWithText(text = "Manuel Vivo", substring = true).performClick()

composeTestRule.onRoot().captureRoboImage()
println(composeTestRule.onRoot().printToString())
try {
composeTestRule.onNodeWithText("3 min read", substring = true).assertExists()
Expand Down
2 changes: 1 addition & 1 deletion JetNews/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ material = "1.9.0"
# @keep
minSdk = "21"
okhttp = "4.10.0"
robolectric = "4.9.2"
robolectric = "4.10.3"
rome = "1.18.0"
room = "2.5.1"
secrets = "2.0.1"
Expand Down