-
Notifications
You must be signed in to change notification settings - Fork 38
Add screenshot testing #30
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9384122
Refactor tests to avoid code duplication
tiwiz 724856b
Add and enable screenshot testing feature
tiwiz 50a2b46
Add screenshot testing feature
tiwiz f60d095
Remove Screenshot library
tiwiz 1ee6462
Remove experimental flag
tiwiz 6be4921
Include Robolectric
tiwiz f81c62b
Include Roborazzi
tiwiz 9540ca7
Create global ui navigation screenshot tests
tiwiz 064dd30
Merge branch 'main' into test-refactoring
tiwiz 9f3b827
Merge branch 'test-refactoring' into screenshot-testing-roborazzi
tiwiz 5ab2e3c
Move tests on different workflow
tiwiz 86c90eb
Add Roborazzi workflow
tiwiz 84dabeb
Update Roborazzi
tiwiz b094154
Update Actions artifacts
tiwiz 8111a8c
Move screenshots to build folder
tiwiz 52cc38f
Create job to update screenshots
tiwiz b279254
Update job
tiwiz 95f191f
Merge workflows for faster response time, and stores the two screensh…
tiwiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,53 @@ | ||
| package com.example.cahier | ||
|
|
||
|
|
||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.test.junit4.createComposeRule | ||
| import androidx.compose.ui.test.onRoot | ||
| import com.example.cahier.data.FakeNotesRepository | ||
| import com.example.cahier.ui.HomePane | ||
| import com.example.cahier.ui.viewmodels.HomeScreenViewModel | ||
| import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers | ||
| import com.github.takahirom.roborazzi.captureRoboImage | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
| import org.robolectric.RobolectricTestRunner | ||
| import org.robolectric.annotation.Config | ||
| import org.robolectric.annotation.GraphicsMode | ||
|
|
||
| @GraphicsMode(GraphicsMode.Mode.NATIVE) | ||
| @RunWith(RobolectricTestRunner::class) | ||
| class ScreenshotTest { | ||
|
|
||
| @get:Rule | ||
| val composeTestRule = createComposeRule() | ||
|
|
||
| private val fakeViewModel = HomeScreenViewModel(FakeNotesRepository()) | ||
|
|
||
| @Composable | ||
| private fun HomeContent() { | ||
| HomePane( | ||
| navigateToCanvas = { _ -> }, | ||
| navigateToDrawingCanvas = { _ -> }, | ||
| navigateUp = {}, | ||
| homeScreenViewModel = fakeViewModel | ||
| ) | ||
| } | ||
|
|
||
| @Config(qualifiers = RobolectricDeviceQualifiers.MediumTablet) | ||
| @Test | ||
| fun globalNavigation_showNavRail() { | ||
| composeTestRule.setContent { HomeContent() } | ||
|
|
||
| composeTestRule.onRoot().captureRoboImage("reference_screenshot_navrail.png") | ||
| } | ||
|
|
||
| @Config(qualifiers = RobolectricDeviceQualifiers.Pixel7Pro) | ||
| @Test | ||
| fun globalNavigation_showBottomNavBar() { | ||
| composeTestRule.setContent { HomeContent() } | ||
|
|
||
| composeTestRule.onRoot().captureRoboImage("reference_screenshot_bottomnavbar.png") | ||
| } | ||
| } | ||
This file contains hidden or 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 @@ | ||
| sdk=34 |
This file contains hidden or 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
This file contains hidden or 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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.