@@ -10,7 +10,6 @@ import androidx.compose.ui.test.onNodeWithText
1010import androidx.compose.ui.test.performClick
1111import androidx.test.platform.app.InstrumentationRegistry
1212import androidx.test.rule.GrantPermissionRule
13- import com.amplifyframework.annotations.InternalAmplifyApi
1413import com.amplifyframework.auth.AuthSession
1514import com.amplifyframework.auth.cognito.AWSCognitoAuthPlugin
1615import com.amplifyframework.core.Action
@@ -36,6 +35,7 @@ import io.mockk.OfTypeMatcher
3635import io.mockk.Runs
3736import io.mockk.every
3837import io.mockk.just
38+ import io.mockk.mockk
3939import io.mockk.mockkConstructor
4040import io.mockk.mockkObject
4141import io.mockk.mockkStatic
@@ -234,7 +234,7 @@ class LivenessFlowInstrumentationTest {
234234 var completesSuccessfully = false
235235 composeTestRule.setContent {
236236 FaceLivenessDetector (sessionId = sessionId, region = " us-east-1" , onComplete = {
237- completesSuccessfully = true
237+ completesSuccessfully = true
238238 }, onError = { assertTrue(false ) })
239239 }
240240
@@ -295,38 +295,59 @@ class LivenessFlowInstrumentationTest {
295295 .fetchSemanticsNodes().size == 1
296296 }
297297
298- @OptIn(InternalAmplifyApi ::class )
299- val faceTargetChallenge = FaceTargetChallenge (
300- 422f , 683f , 230f , 292f ,
301- FaceTargetMatchingParameters (
302- 0.7f ,
303- 0.25f ,
304- 0.25f ,
305- 0.15f ,
306- 0.15f
307- )
298+ val faceTargetMatchingParameters = mockk<FaceTargetMatchingParameters >()
299+ every { faceTargetMatchingParameters.targetIouThreshold }.returns(0.7f )
300+ every { faceTargetMatchingParameters.targetIouWidthThreshold }.returns(0.25f )
301+ every { faceTargetMatchingParameters.targetIouHeightThreshold }.returns(0.25f )
302+ every { faceTargetMatchingParameters.faceIouWidthThreshold }.returns(0.15f )
303+ every { faceTargetMatchingParameters.faceIouHeightThreshold }.returns(0.15f )
304+
305+ val faceTargetChallenge = mockk<FaceTargetChallenge >()
306+ every { faceTargetChallenge.targetWidth }.returns(422f )
307+ every { faceTargetChallenge.targetHeight }.returns(683f )
308+ every { faceTargetChallenge.targetCenterX }.returns(230f )
309+ every { faceTargetChallenge.targetCenterY }.returns(292f )
310+ every { faceTargetChallenge.faceTargetMatching }.returns(faceTargetMatchingParameters)
311+
312+ val colors = listOf (
313+ RgbColor (0 , 0 , 0 ),
314+ RgbColor (0 , 255 , 255 ),
315+ RgbColor (255 , 0 , 0 ),
316+ RgbColor (0 , 255 , 0 ),
317+ RgbColor (0 , 0 , 255 ),
318+ RgbColor (255 , 255 , 0 ),
319+ RgbColor (0 , 255 , 0 ),
320+ RgbColor (255 , 0 , 0 ),
308321 )
309- val colorChallenge = ColorChallenge (
310- " id" ,
311- ColorChallengeType .SEQUENTIAL ,
312- listOf (
313- ColorDisplayInformation (RgbColor (0 ,0 ,0 ), 75f , false ),
314- ColorDisplayInformation (RgbColor (0 ,255 ,255 ), 475f , false ),
315- ColorDisplayInformation (RgbColor (255 ,0 ,0 ), 475f , false ),
316- ColorDisplayInformation (RgbColor (0 ,255 ,0 ), 475f , false ),
317- ColorDisplayInformation (RgbColor (0 ,0 ,255 ), 475f , false ),
318- ColorDisplayInformation (RgbColor (255 ,255 ,0 ), 475f , false ),
319- ColorDisplayInformation (RgbColor (0 ,255 ,0 ), 475f , false ),
320- ColorDisplayInformation (RgbColor (255 ,0 ,0 ), 475f , false ),
321- )
322+ val durations = listOf (
323+ 75f ,
324+ 475f ,
325+ 475f ,
326+ 475f ,
327+ 475f ,
328+ 475f ,
329+ 475f ,
330+ 475f ,
322331 )
332+ val challengeColors = List (colors.size) {
333+ val colorDisplayInformation = mockk<ColorDisplayInformation >()
334+ every { colorDisplayInformation.color }.returns(colors[it])
335+ every { colorDisplayInformation.duration }.returns(durations[it])
336+ every { colorDisplayInformation.shouldScroll }.returns(false )
337+ colorDisplayInformation
338+ }
339+ val colorChallenge = mockk<ColorChallenge >()
340+ every { colorChallenge.challengeId }.returns(" id" )
341+ every { colorChallenge.challengeType }.returns(ColorChallengeType .SEQUENTIAL )
342+ every { colorChallenge.challengeColors }.returns(challengeColors)
343+
323344 onSessionStarted.captured.accept(
324345 FaceLivenessSession (
325346 listOf (faceTargetChallenge, colorChallenge),
326347 {}, // onVideoEvent
327348 {}, // onChallengeResponseEvent
328- {} // stopLivenessSession
329- )
349+ {}, // stopLivenessSession
350+ ),
330351 )
331352
332353 composeTestRule.waitUntil(5000 ) {
0 commit comments