cypress - 在 cypress 文件夹外指定 customSnapshotsDir 时出错
问题描述
当我运行我的测试时,我不想在代理机器上保存任何屏幕截图,我想将这些图像保存到自定义目录,当我尝试这样做时,我收到此错误 RangeError: Maximum call stack size exceeded。如果我在 cypress 目录中提供一个文件夹路径,比如这个 cypress\my 文件夹,这很好用
我们真的可以将屏幕截图文件保存到与 cypress 目录不同的文件夹路径吗?
addMatchImageSnapshotCommand(
{
failureThreshold: 0.00, // threshold for entire image
failureThresholdType: 'percent', // percent of image or number of pixels
customDiffConfig: { threshold: 0.0 }, // threshold for each pixel
capture: 'viewport', // capture viewport in screenshot
customSnapshotsDir:'C:\foldername',
customDiffDir:'C:\foldername'
}
);
解决方案
您可以更改cypress.json
文件中屏幕截图的默认路径。
只需添加screenshotsFolder
属性。
{
"screenshotsFolder": "./my/custom/path"
}
推荐阅读
- android - 从 uri 获取数据列的值时出现 IllegalArgumentException
- swagger - 使用什么注释来定义 HTTP 请求标头?
- rust - Rust 编译器是否将 String 隐式转换为 &str?
- c++ - 从 file.cpp 映射到 file.o cmake
- revit-api - C# Revit API,如何使用 ExternalCommand 创建简单的墙?
- python - 无法安装 Pyaudio
- shell - 在 awk 中比较 2 个文件
- javascript - 我如何在nodeJS中比较来自mongodb的日期
- python - 在字典列表中查找键值
- c# - 以特定语言格式化值的任何方式