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

[#74] Create HomeScreenUITest #86

Merged
merged 7 commits into from
Feb 20, 2023

Conversation

Wadeewee
Copy link
Contributor

@Wadeewee Wadeewee commented Jan 30, 2023

#74

What happened 👀

Create HomeScreen as UI Test.

Insight 📝

  • Add testInstrumentationRunner in defaultConfig
  • Add dependencies libs for UI Test:
    • androidx.compose.ui:ui-test-junit4
    • io.mockk:mockk-android
    • io.mockk:mockk-agent-android
    • io.kotest:kotest-assertions-core
  • To use mockk-agent-android, we need to upgrade the version of Mocck to 1.12.3 if not, we will get this error:
    Screen Shot 2566-02-06 at 08 55 38
  • Add packagingOptions and set the jniLibs to useLegacyPackaging = true to fix this error:

Screen Shot 2566-02-06 at 09 32 13

  • Add CoroutineTestRule.
  • Add BaseScreenTest.
  • Add MockUtil.

Proof Of Work 📹

Screen.Recording.2566-01-30.at.15.17.11.mov

@Wadeewee Wadeewee self-assigned this Jan 30, 2023
@Wadeewee Wadeewee marked this pull request as draft January 30, 2023 08:30
Base automatically changed from chore/69-create-home-screen-unit-test to develop February 1, 2023 07:07
@github-actions
Copy link

github-actions bot commented Feb 1, 2023

8 Warnings
⚠️ /home/runner/.gradle/caches/transforms-3/fc63d10724654858d2ee5b467b86b5a7/transformed/jetified-dagger-lint-aar-2.43.2/jars/lint.jar#L0 - Lint found an issue registry (dagger.lint.DaggerIssueRegistry) which requires a newer API level. That means that the custom lint checks are intended for a newer lint version; please upgrade.
⚠️ app/src/main/AndroidManifest.xml#L10 - On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup, or just set android:fullBackupOnly=true. More info: https://developer.android.com/guide/topics/data/autobackup
⚠️ app/src/main/AndroidManifest.xml#L13 - Attribute networkSecurityConfig is only used in API level 24 and higher (current min is 23)
⚠️ app/src/main/java/co/nimblehq/compose/crypto/ui/common/Toaster.kt#L16 - Toast created but not shown: did you forget to call show() ?
⚠️ app/src/main/res/drawable/ic_back.xml#L8 - Attribute fillType is only used in API level 24 and higher (current min is 23)
⚠️ app/src/main/res/drawable/ic_fire_opal_arrow_down.xml#L8 - Attribute fillType is only used in API level 24 and higher (current min is 23)
⚠️ app/src/main/res/drawable/ic_guppie_green_arrow_up.xml#L8 - Attribute fillType is only used in API level 24 and higher (current min is 23)
⚠️ app/src/main/res/navigation/nav_graph_main.xml#L2 - The resource R.navigation.nav_graph_main appears to be unused

CoroutineTemplate Jacoco report:

Generated by 🚫 Danger

@Wadeewee Wadeewee force-pushed the chore/74-create-home-screen-ui-test branch 3 times, most recently from a5d3ee7 to 2792b49 Compare February 6, 2023 02:34
@Wadeewee Wadeewee force-pushed the chore/74-create-home-screen-ui-test branch from 2792b49 to 5d95fc7 Compare February 6, 2023 03:14
@Wadeewee Wadeewee marked this pull request as ready for review February 6, 2023 03:20
@Wadeewee
Copy link
Contributor Author

Wadeewee commented Feb 6, 2023

Another concern is we need to omit the last two test cases from HomeScreenTest:

@Test
fun `When pulled to refresh and load MyCoins successfully, it render the UI properly`()
@Test
fun `When pulled to refresh and load TrendingCoins successfully, it render the UI properly`()

It seems like the PullRefreshIndicator doesn't show when we perform this action:

 onRoot().performTouchInput { swipeDown() }

That's why we can't test these test cases. Please let me know if you have any insight into this, the problem is similar to my above concern, I guess 🙏

Copy link

@doannimble doannimble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

Copy link
Member

@luongvo luongvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

@Wadeewee
Copy link
Contributor Author

@hoangnguyen92dn @kaungkhantsoe @luongvo @doannimble, Regarding this issue, I think we can investigate it later as It works fine when creating the Unit Test with Robolectric in HomeScreenTest 🙏

Copy link
Member

@luongvo luongvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest lgtm; please check my reply on this issue too #86 (comment)

@Wadeewee Wadeewee force-pushed the chore/74-create-home-screen-ui-test branch from 0f12293 to b905c32 Compare February 20, 2023 04:06
Copy link
Member

@luongvo luongvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@luongvo luongvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Wadeewee much better 👏

@hoangnguyen92dn hoangnguyen92dn merged commit 7326762 into develop Feb 20, 2023
@hoangnguyen92dn hoangnguyen92dn deleted the chore/74-create-home-screen-ui-test branch February 20, 2023 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants