Skip to content

Commit 2cf564a

Browse files
author
Thomas Leing
committed
Face positioning for integration tests
1 parent 66c5703 commit 2cf564a

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

liveness/src/androidTest/java/com/amplifyframework/ui/liveness/LivenessFlowInstrumentationTest.kt

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import com.amplifyframework.core.Action
1717
import com.amplifyframework.core.Amplify
1818
import com.amplifyframework.core.Consumer
1919
import com.amplifyframework.predictions.aws.AWSPredictionsPlugin
20+
import com.amplifyframework.predictions.aws.models.ColorChallenge
21+
import com.amplifyframework.predictions.aws.models.ColorChallengeType
22+
import com.amplifyframework.predictions.aws.models.ColorDisplayInformation
2023
import com.amplifyframework.predictions.aws.models.FaceTargetChallenge
24+
import com.amplifyframework.predictions.aws.models.FaceTargetMatchingParameters
25+
import com.amplifyframework.predictions.aws.models.RgbColor
2126
import com.amplifyframework.predictions.models.FaceLivenessSession
2227
import com.amplifyframework.predictions.models.FaceLivenessSessionInformation
2328
import com.amplifyframework.predictions.options.FaceLivenessSessionOptions
@@ -291,8 +296,43 @@ class LivenessFlowInstrumentationTest {
291296
}
292297

293298
@OptIn(InternalAmplifyApi::class)
294-
val faceTargetChallenge = FaceTargetChallenge()
295-
onSessionStarted.captured.accept(FaceLivenessSession(listOf(FaceTargetChallenge, ColorChallenge)))
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+
)
308+
)
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+
)
323+
onSessionStarted.captured.accept(
324+
FaceLivenessSession(
325+
listOf(faceTargetChallenge, colorChallenge),
326+
{}, // onVideoEvent
327+
{}, // onChallengeResponseEvent
328+
{} // stopLivenessSession
329+
)
330+
)
331+
332+
composeTestRule.waitUntil(5000) {
333+
composeTestRule.onAllNodesWithText("asdlkfjasdf")
334+
.fetchSemanticsNodes().size == 1
335+
}
296336

297337
composeTestRule.waitForIdle()
298338

0 commit comments

Comments
 (0)