@@ -25,6 +25,7 @@ import androidx.compose.ui.test.performClick
2525import androidx.compose.ui.test.performScrollTo
2626import androidx.compose.ui.test.performSemanticsAction
2727import androidx.compose.ui.test.performTextInput
28+ import androidx.compose.ui.test.performTextReplacement
2829import androidx.compose.ui.test.v2.runComposeUiTest
2930import id.walt.walletdemo.compose.logic.DemoPinStore
3031import id.walt.walletdemo.compose.logic.DemoWallet
@@ -292,6 +293,7 @@ class WalletDemoAppTestScenarios {
292293
293294 fun invalidPresentationCanBeDismissedLocallyOrReportedToVerifier () = runComposeUiTest {
294295 val error = WalletDemoPresentationError (
296+ previewHandle = samplePresentationPreview.previewHandle,
295297 verifier = VerifierDetails (name = " Example Verifier" , clientId = " https://verifier.example" ),
296298 errorCode = " invalid_transaction_data" ,
297299 message = " Unsupported transaction data type" ,
@@ -325,7 +327,7 @@ class WalletDemoAppTestScenarios {
325327 waitUntil(timeoutMillis = 5_000 ) { controller.state.value.presentationError == null }
326328
327329 assertEquals(null , wallet.rejectedRequestUrl)
328- onNodeWithTag(WalletUiTestTags .PresentationInput ).assertIsEnabled().performTextInput (" openid4vp://invalid" )
330+ onNodeWithTag(WalletUiTestTags .PresentationInput ).assertIsEnabled().performTextReplacement (" openid4vp://invalid" )
329331 onNodeWithTag(WalletUiTestTags .PresentButton ).performClick()
330332 waitUntil(timeoutMillis = 5_000 ) { controller.state.value.presentationError == error }
331333 onNodeWithTag(WalletUiTestTags .PresentationErrorNotifyButton ).performScrollTo().performClick()
@@ -375,8 +377,8 @@ class WalletDemoAppTestScenarios {
375377 onNodeWithTag(" wallet.tab.present" ).performClick()
376378 onNodeWithTag(" wallet.status" ).assertTextContains(" Presentation sent" )
377379 onNodeWithTag(" wallet.presentationInput" ).assertIsNotEnabled()
378- assertPresentationNewActionPrecedesReadOnlyReview ()
379- onNodeWithTag (WalletUiTestTags .credentialCard(samplePresentationCredentialOption.selection.id)).performScrollTo().assertIsDisplayed( )
380+ onNodeWithTag( WalletUiTestTags . PresentationNewButton ).performScrollTo().assertIsDisplayed ()
381+ onAllNodesWithTag (WalletUiTestTags .PresentationReview ).assertCountEquals( 0 )
380382 onAllNodesWithTag(" wallet.presentationSubmitButton" ).assertCountEquals(0 )
381383 onAllNodesWithTag(" wallet.presentationRejectButton" ).assertCountEquals(0 )
382384 onNodeWithTag(" wallet.presentationNewButton" ).performScrollTo().performClick()
@@ -780,28 +782,6 @@ class WalletDemoAppTestScenarios {
780782 onNodeWithText(" nonce-456" ).performScrollTo().assertIsDisplayed()
781783 }
782784
783- private fun ComposeUiTest.assertPresentationNewActionPrecedesReadOnlyReview () {
784- val presentTabLandmarkTags = onAllNodes(
785- matcher = hasAnyAncestor(hasTestTag(" wallet.presentTabContent" )) and (
786- hasTestTag(" wallet.presentationNewButton" ) or
787- hasTestTag(" wallet.presentationReview" )
788- ),
789- useUnmergedTree = true ,
790- )
791- .fetchSemanticsNodes()
792- .mapNotNull { it.config.getOrElseNullable(SemanticsProperties .TestTag ) { null } }
793-
794- val newActionIndex = presentTabLandmarkTags.indexOf(" wallet.presentationNewButton" )
795- val reviewIndex = presentTabLandmarkTags.indexOf(" wallet.presentationReview" )
796-
797- assertTrue(newActionIndex >= 0 , " New presentation action is missing: $presentTabLandmarkTags " )
798- assertTrue(reviewIndex >= 0 , " Read-only presentation review is missing: $presentTabLandmarkTags " )
799- assertTrue(
800- newActionIndex < reviewIndex,
801- " New presentation action should precede the read-only review so starting over stays easy: $presentTabLandmarkTags " ,
802- )
803- }
804-
805785 companion object {
806786 val sampleCredential = WalletDemoCredential (
807787 id = " cred-1" ,
@@ -919,6 +899,7 @@ private class FakeDemoWallet(
919899 var presentedRequestUrl: String? = null
920900 var previewedRequestUrl: String? = null
921901 var submittedRequestUrl: String? = null
902+ var rejectedRequestUrl: String? = null
922903 private val issuanceSources = mutableMapOf<WalletDemoIssuancePreviewHandle , String >()
923904 private val presentationSources = mutableMapOf<WalletDemoPresentationPreviewHandle , String >()
924905
@@ -976,8 +957,8 @@ private class FakeDemoWallet(
976957 override suspend fun rejectPresentation (
977958 previewHandle : WalletDemoPresentationPreviewHandle ,
978959 ): WalletDemoOperationResult {
979- submittedRequestUrl = presentationSources[previewHandle]
980- return presentationResult
960+ rejectedRequestUrl = presentationSources[previewHandle]
961+ return WalletDemoOperationResult . Success ( " Presentation declined " )
981962 }
982963
983964 override suspend fun discardPresentationPreview (previewHandle : WalletDemoPresentationPreviewHandle ) {
0 commit comments