docker - 使用 docker image testcafe/testcafe 时没有创建截图目录的权限

标签 docker automated-tests e2e-testing web-testing testcafe

我正在使用 https://hub.docker.com/r/testcafe/testcafe/

运行我们的 Testcafe 项目,它工作正常,除了失败时无法创建屏幕截图目录,原因是:

Error: EACCES: permission denied, mkdir '/screenshots'

是否有可能完成这项工作,我是否遗漏了什么?

我试过:

--screenshots ./screenshots 

和:

--screenshots {full path to directory}/screenshots

如何授予此 docker 容器的访问权限以写入主机上的目录以供将来引用?

最佳答案

最简单的解决方案是在您的 Docker 主机上创建一个 screenshots 目录,配置正确的权限并将此目录作为卷传递给容器。您可以使用以下命令作为引用:

mkdir screenshots

chmod a=rwx screenshots

docker run -it --rm -v ./tests:/tests -v ./screenshots:/screenshots testcafe/testcafe firefox /tests --screenshots /screenshots

关于docker - 使用 docker image testcafe/testcafe 时没有创建截图目录的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55260795/

相关文章:

reactjs - 使用 ReactSelector for TestCafe 时不断收到 `ReExecutablePromise { _then: [], _fn: [Function], _taskPromise: null }`

javascript - 错误消息 ""索引“参数应该是一个数字,但它是数字”不清楚

selenium-webdriver - Protractor/ Selenium : run browser in the background

node.js - 是否可以使用 testcafe/node 模拟由单击按钮触发的函数的结果?

automation - 在每个环境中使用不同的 URL 运行相同的 Testcafe 测试

ruby-on-rails - 无法通过docker启动rails应用程序

docker - 使用 CMD 和 PowerShell 静默安装 exe 文件

Docker GELF 记录附加字段

docker - 如何通过Zuul代理从一种微服务访问另一种微服务

testing - 为什么 TestCafe 在使用简单的命令行启动测试 Electron 应用程序时会崩溃?