Created
August 23, 2022 00:50
-
-
Save markchristopherng/141c30b6d09f839c75d91b70d0b6420c to your computer and use it in GitHub Desktop.
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
class AccountDetailsPage constructor(private val composeTestRule: ComposeContentTestRule) { | |
val personalDetails: PersonalDetails | |
get() = | |
with(composeTestRule) { | |
PersonalDetails( | |
preferredName = TitleValue( | |
title = onNestedChild(UiAssert.stringRes(R.string.glam_preferred_name), "txt_title"), | |
value = onNestedChild(UiAssert.stringRes(R.string.glam_preferred_name), "txt_subtitle") | |
), | |
lastName = TitleValue( | |
title = onNestedChild(UiAssert.stringRes(R.string.glam_surname), "txt_title"), | |
value = onNestedChild(UiAssert.stringRes(R.string.glam_surname), "txt_subtitle") | |
), | |
givenName = TitleValue( | |
title = onNestedChild(UiAssert.stringRes(R.string.glam_given_name), "txt_title"), | |
value = onNestedChild(UiAssert.stringRes(R.string.glam_given_name), "txt_subtitle") | |
), | |
dateOfBirth = TitleValue( | |
title = onNestedChild(UiAssert.stringRes(R.string.glam_date_of_birth), "txt_title"), | |
value = onNestedChild(UiAssert.stringRes(R.string.glam_date_of_birth), "txt_subtitle") | |
), | |
) | |
} | |
data class PersonalDetails( | |
val preferredName: TitleValue, | |
val lastName: TitleValue, | |
val givenName: TitleValue, | |
val dateOfBirth: TitleValue, | |
) | |
data class TitleValue( | |
val title: SemanticsNodeInteraction, | |
val value: SemanticsNodeInteraction | |
) { | |
fun assertText(titleText: String, valueText: String) { | |
title.assert(hasText(titleText)) | |
value.assert(hasText(valueText)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment