Testcafe 在启用了 SIP 的 MacOS 映像上无法运行的事实是否有任何解决方案? [英] Are there any solutions to the fact that Testcafe doesn't work on MacOS images with SIP enabled?

查看:39
本文介绍了Testcafe 在启用了 SIP 的 MacOS 映像上无法运行的事实是否有任何解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们使用 Github Actions 来运行我们的 Testcafe 套件,但问题是在 macos-latest 映像(即 10.15 Catalina)上运行 Safari 测试时出现以下错误:

Currently, we use Github Actions to run our Testcafe suites, but the problem is running Safari tests on the macos-latest image, which is 10.15 Catalina, gives the following error:

UnableToAccessScreenRecordingAPIError:查找窗口进程无法访问屏幕录制 API.

这是因为 MacOS 图像没有默认授予的权限.显然,您无法以编程方式处理此问题,并且在 10.15 Catalina 中启用了一项名为 SIP 的功能,可阻止您绕过它.这在此处讨论.

This is because MacOS images don't come with that permission granted by default. Apparently you can't handle this programmatically, and there's a feature called SIP that is turned on in 10.15 Catalina that stops you from getting around it. This is discussed here.

由于我们依赖 Github 提供图像,因此他们无法向我们提供所讨论的非 SIP 图像此处.提供的解决方法没有任何帮助.

Since we're relying on Github to provide images, they've not been able to provide us with a non-SIP image as discussed here. The workarounds provided there have been of no help.

还有其他想法吗?

推荐答案

正如您已经提到的,由于 MacOS 计算机上启用了 SIP,TestCafe 不会捕获屏幕截图并调整它们的大小.但是,可以使用远程模式,因为默认情况下禁用平台特定功能.您可以执行以下步骤:

As you already mentioned, TestCafe doesn't capture screenshots and resize them because of SIP enabled on machines with MacOS. However, it is possible to use the remote mode since the platform specific functionality is disabled by default. You can execute these steps:

testcafe remote test.js --hostname ${HOSTNAME} --ports ${PORT1},${PORT2} &
pid=$!
open -a Safari http://${HOSTNAME}:${PORT1}/browser/connect
wait $pid

这篇关于Testcafe 在启用了 SIP 的 MacOS 映像上无法运行的事实是否有任何解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆