macosjenkinsautomated-testsintegration-testingmicrophone

How can an app be automatically tested if it needs mic access on MacOS (Ventura 13.3)


I’m working on automated Jenkins CI tests for a realtime audio application. I use playwright to interact with the app, but the mic acces is requested by the app itself, not playwight/the nightly browser. On an x64 (Monterey 12.6) the app just has permission to access the mic (we are not using a real mic, but BlackHole for Audio routing). But on the Arm Mac (Ventura 13.3) the app requested access must be granted manually.

This makes automated testing really hard. If I remote control the CI workstation and manually start the app / enable mic access in the privacy settings it works fine. But when the app is run by the automation, it doesn’t get any audio input.

How do you go about test automation for apps that require mic access? Any Idea how to solve this issue?

I already tried to edit the permissions manually by editing the com.apple.TCC/TCC.db, but I couldn’t do it for the system wide TCC.db (error: attempt to write a readonly database). If I modify the user TCC.db it has the has the same effect as manually granting access, which does not work for the automated tests.

Any help would be greatly appreciated!


Solution

  • I had a similar Problem. When starting them manually the apps had the permissions, but not on Jenkins.

    I was able to fix it by using manually staring the Jenkins launchAgent when I'm connected via VNC. The running launch agent needs to be stopped before you can do that:

    launchctl unload /Library/LaunchAgents/org.jenkins-ci.plist
    

    Then manually run the agent.jar configured for your setup

    setsid java -Dorg.jenkinsci.plugins.gitclient.CliGitAPIImpl.useSETSID=true -jar agent.jar -jnlpUrl <jenkins-agent.jnlp> -secret <SECRET> -workDir <WORKDIR>
    

    In my case this causes ssh authetification issues with GitHub so I use HTTPS now, but The app executed by Jenkins now has mic access.