-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Roborazzi Screenshot test for Tutorial's Welcome page (#882)
- Loading branch information
1 parent
b7160cc
commit 3d8f2e9
Showing
5 changed files
with
75 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+142 Bytes
(100%)
reference-apps/tutorial/app/src/main/assets/figma/TutorialDoc_3z4xExq0INrL9vxPhj9tl7.dcf
Binary file not shown.
32 changes: 0 additions & 32 deletions
32
...nce-apps/tutorial/app/src/test/java/com/android/designcompose/tutorial/ExampleUnitTest.kt
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
.../tutorial/app/src/testDebug/kotlin/com/android/designcompose/tutorial/CheckStartupPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* 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 | ||
* | ||
* http://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. | ||
*/ | ||
|
||
package com.android.designcompose.tutorial | ||
|
||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.onRoot | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers | ||
import com.github.takahirom.roborazzi.RoborazziRule | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.annotation.Config | ||
import org.robolectric.annotation.GraphicsMode | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@Config(qualifiers = RobolectricDeviceQualifiers.MediumTablet, sdk = [34]) | ||
@GraphicsMode(GraphicsMode.Mode.NATIVE) | ||
class CheckStartupPage { | ||
@get:Rule val composeTestRule = createComposeRule() | ||
|
||
@get:Rule | ||
val roborazziRule = | ||
RoborazziRule( | ||
composeRule = composeTestRule, | ||
// Specify the node to capture for the last image | ||
captureRoot = composeTestRule.onRoot(), | ||
options = | ||
RoborazziRule.Options( | ||
outputDirectoryPath = "src/testDebug/roborazzi", | ||
// Always capture the last image of the test | ||
captureType = RoborazziRule.CaptureType.LastImage() | ||
) | ||
) | ||
|
||
@Test | ||
fun testStartupPage() { | ||
with(composeTestRule) { | ||
setContent { TutorialMain() } | ||
onNodeWithText( | ||
"Congratulations on running the Automotive Design for Compose Tutorial app!", | ||
substring = true | ||
) | ||
.assertExists() | ||
} | ||
} | ||
} |
Binary file added
BIN
+154 KB
...borazzi/com.android.designcompose.tutorial.CheckStartupPage.testStartupPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.