The code above can automate testing for the app Replika for text and image input.
The app Replika must be downloaded on an android emulator.
More instructions are in the comments of the code.
Demo videos for how the code works:
text input: https://youtu.be/Hz6wMtqn54Y
image input: https://youtu.be/fA30aUp6AHI