如何在MacOS(Ventura 13.3)上自动测试需要麦克风访问权限的应用程序?

huangapple go评论101阅读模式
英文:

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

问题

我正在为实时音频应用程序开发自动化的Jenkins CI测试。我使用playwright来与应用程序交互,但麦克风访问是由应用程序自身请求的,而不是由playwright/夜间浏览器请求的。在x64(Monterey 12.6)上,该应用程序只需获得访问麦克风的权限(我们不使用真实的麦克风,而是用于音频路由的BlackHole)。但在Arm Mac(Ventura 13.3)上,必须手动授予应用程序请求的访问权限。

这使得自动化测试非常困难。如果我远程控制CI工作站并手动启动应用程序/在隐私设置中启用麦克风访问,那么一切都正常。但当应用程序由自动化执行时,它无法获得任何音频输入。

您如何进行需要麦克风访问的应用程序的测试自动化?
有没有解决此问题的任何想法?

我已经尝试通过编辑com.apple.TCC/TCC.db来手动编辑权限,但我无法为全局的TCC.db执行此操作(错误:尝试写入只读数据库)。
如果我修改用户TCC.db,它会产生与手动授权相同的效果,这对于自动化测试不起作用。

非常感谢任何帮助!

英文:

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!

答案1

得分: 1

我遇到了类似的问题。当我手动启动应用程序时,应用程序具有权限,但在Jenkins上没有权限。

我能够通过在通过VNC连接时手动启动Jenkins启动代理来解决此问题。在执行此操作之前,需要停止正在运行的启动代理:

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

然后手动运行为您的设置配置的agent.jar:

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

在我的情况下,这会导致与GitHub的SSH身份验证问题,因此我现在使用HTTPS,但由Jenkins执行的应用程序现在具有麦克风访问权限。

英文:

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 &lt;jenkins-agent.jnlp&gt; -secret &lt;SECRET&gt; -workDir &lt;WORKDIR&gt;

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.

huangapple
  • 本文由 发表于 2023年6月12日 15:48:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76454549.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定