-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/ASAA-23 Compose UI x Karumi Shot Testing #85
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
Open
Br-DiorD
wants to merge
15
commits into
develop
Choose a base branch
from
feature/ASAA-23-karumi
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d0ffe7f
implementation commit
Br-DiorD ebedef0
stable commit 1
Br-DiorD c880b92
fix test failure due to duplicate screenshots
Br-DiorD 80a2baf
move file location
Br-DiorD 21fe073
Merge branch 'develop' of https://github.com/BottleRocketStudios/Andr…
Br-DiorD 95e6c87
Add todo
Br-DiorD 9f51a4d
Merge branch 'develop' of https://github.com/BottleRocketStudios/Andr…
Br-DiorD cc70154
Add PR screenshot tests
Br-DiorD 26e3ca3
AASA-23 build: Update shot version, add shared Run Configurations, an…
jaredstockton 7ac21f3
Merge branch 'develop' of https://github.com/BottleRocketStudios/Andr…
Br-DiorD 64be96c
delete extra executeScreenshotTest mod(use interal instead) / nit cle…
Br-DiorD 2882dbd
Merge branch 'develop' of https://github.com/BottleRocketStudios/Andr…
Br-DiorD d0c8a71
test on other devices/error search/add Base file with Confluence Link
Br-DiorD 0a8e184
update README.md
Br-DiorD 1e9aadb
wrap renderComponent() in ArchitectureDemoTheme {} so screenshots hav…
Br-DiorD 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file added
BIN
+133 KB
...tudios.brarchitecture.ui.HomeScreenUITest_homeScreenNoResultItemsScreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+128 KB
...tudios.brarchitecture.ui.HomeScreenUITest_homeScreenWithListItemsScreenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| package="com.bottlerocketstudios.brarchitecture.test" | ||
| android:sharedUserId="com.bottlerocketstudios.brarchitecture.uid"> | ||
|
|
||
| </manifest> |
115 changes: 115 additions & 0 deletions
115
app/src/androidTest/java/com/bottlerocketstudios/brarchitecture/HomeScreenUITest.kt
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,115 @@ | ||
| package com.bottlerocketstudios.brarchitecture | ||
|
|
||
| import androidx.compose.ui.test.junit4.createComposeRule | ||
| import androidx.compose.ui.test.onRoot | ||
| import com.bottlerocketstudios.brarchitecture.domain.models.GitRepository | ||
| import com.bottlerocketstudios.brarchitecture.domain.models.Link | ||
| import com.bottlerocketstudios.brarchitecture.domain.models.Links | ||
| import com.bottlerocketstudios.brarchitecture.domain.models.User | ||
| import com.bottlerocketstudios.brarchitecture.domain.models.Workspace | ||
| import com.bottlerocketstudios.compose.home.HomeScreen | ||
| import com.bottlerocketstudios.compose.home.HomeScreenState | ||
| import com.bottlerocketstudios.compose.home.UserRepositoryUiModel | ||
| import com.bottlerocketstudios.compose.util.StringIdHelper | ||
| import com.bottlerocketstudios.compose.util.asMutableState | ||
| import com.karumi.shot.ScreenshotTest | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import java.time.ZonedDateTime | ||
|
|
||
| class HomeScreenUITest : ScreenshotTest { | ||
|
|
||
| @get:Rule | ||
| val composeRule = createComposeRule() | ||
|
|
||
| @Test | ||
| fun homeScreenWithListItemsScreenshot() { | ||
| renderComponent( | ||
| HomeScreenState( | ||
| repositories = listOf(testCard1, testCard2).asMutableState(), | ||
| itemSelected = {} | ||
| ) | ||
| ) | ||
|
|
||
| compareScreenshot(composeRule.onRoot()) | ||
| } | ||
|
|
||
| @Test | ||
| fun homeScreenNoResultItemsScreenshot() { | ||
| renderComponent( | ||
| HomeScreenState( | ||
| repositories = emptyList<UserRepositoryUiModel>().asMutableState(), | ||
| itemSelected = {} | ||
| ) | ||
| ) | ||
|
|
||
| compareScreenshot(composeRule.onRoot()) | ||
| } | ||
|
|
||
| fun renderComponent(state: HomeScreenState? = null) { | ||
Br-DiorD marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| composeRule.setContent { | ||
| if (state != null) HomeScreen(state) | ||
Br-DiorD marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| // todo move somewhere that both UI test and Compose Preview | ||
| // can share it instead of setting it twice. | ||
| internal val testCard1 = UserRepositoryUiModel( | ||
| GitRepository( | ||
| scm = "scm1", | ||
| name = "name1", | ||
| owner = User( | ||
| username = "username1", | ||
| nickname = "nickname1", | ||
| accountStatus = "accountStatus1", | ||
| displayName = "displayName1", | ||
| createdOn = "createdOn1", | ||
| uuid = "uuid1", | ||
| links = Links( | ||
| avatar = Link( | ||
| href = "href1", name = "" | ||
| ) | ||
| ), | ||
| avatarUrl = "avatarUrl1" | ||
| ), | ||
| workspace = Workspace( | ||
| slug = "slug1", | ||
| name = "name1", | ||
| uuid = "uuid1" | ||
| ), | ||
| isPrivate = false, | ||
| description = "description1", | ||
| updated = ZonedDateTime.now() | ||
| ), | ||
| formattedLastUpdatedTime = StringIdHelper.Raw("") | ||
| ) | ||
| internal val testCard2 = UserRepositoryUiModel( | ||
| GitRepository( | ||
| scm = "scm2", | ||
| name = "name2", | ||
| owner = User( | ||
| username = "username2", | ||
| nickname = "nickname2", | ||
| accountStatus = "accountStatus2", | ||
| displayName = "displayName2", | ||
| createdOn = "createdOn2", | ||
| uuid = "uuid2", | ||
| links = Links( | ||
| avatar = Link( | ||
| href = "href2", name = "" | ||
| ) | ||
| ), | ||
| avatarUrl = "avatarUrl2" | ||
| ), | ||
| workspace = Workspace( | ||
| slug = "slug2", | ||
| name = "name2", | ||
| uuid = "uuid2" | ||
| ), | ||
| isPrivate = false, | ||
| description = "description2", | ||
| updated = ZonedDateTime.now() | ||
| ), | ||
| formattedLastUpdatedTime = StringIdHelper.Raw("") | ||
| ) | ||
| } | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Br-DiorD Think I figured out our issue. We should wrap HomeScreen like this:
ArchitectureDemoTheme {
HomeScreen(state)
}
Also, Could HomeScreenState in function signature be non null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BottleRocket-Colin nice! I'll give it a shot after this meeting. I do wonder why it is only an issue on certain screenshots because the Pull RequestScreenshot shot is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Br-DiorD _ would say that the PR request screenshot is probably not correct but just closer to being correct. It's a matter of where our h4 and h5 typographies are closer to the default sizes but our h1 is very small compared to the h1 default. So some screens will show closer to correct than others depending on which typography elements are being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BottleRocket-Colin fixed. Sorry for the delay :)