I am setting up automated (e2e) tests (using Detox) for an iOS app. Part of the app records and processes audio input. In order to fully test the app I need to be able to simulate audio input. Ideally by playing back a specific audio file. But it could be any audio at this stage. I am trying to work out if and how I might be able to achieve this. Detox uses EarlGrey which supports most UI interactions, but not audio.
One possibility is to include some kind of special "mock" mode which detects when its being run in a test, and instead of recording input from the microphone, stream it from a file. But I'd rather not have to tinker with the application code like this if possible.
Detox 5.5.0 supports additional launch arguments
await device.launchApp({launchArgs: {arg1: 1, arg2: "2"}});
Which can then be accessed in your app:
[NSProcessInfo processInfo] arguments][@"arg1"]
[NSProcessInfo processInfo] arguments][@"arg2"]