视频路径问题



TestCafe 无法识别视频路径的 ${TEST}。

我正在尝试为失败的测试实施测试记录,以查看我们如何复制出现的问题,但即使类似的路径模式适用于屏幕截图,也无法识别视频路径。

根据文档,这应该有效,但会显示以下警告:

Warnings (1):
The "${TEST}" path pattern placeholder cannot be applied to the recorded video.
The placeholder was replaced with an empty string.

我创建了TestRunner.js如 https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html 所示。然后我添加了

if(runnerOptions.takeVideo === true && runInParallel === 1) {
runner.video(reports.videoPath, {
singleFile: true,
failedOnly: true,
pathPattern: store + '-' + env + '/${TEST}/${DATE}_${TIME}/${USERAGENT}'
})
}
return runner
.src(tests)
.browsers(config.browsers)
.screenshots(reports.screenshotPath, runnerOptions.takeScreenshots,
store + '-' + env + '/${TEST}/${DATE}_${TIME}/${RUN_ID}/${USERAGENT}/step-${FILE_INDEX}')
.concurrency(runInParallel)
.run(runnerOptions.run);

正如我所说,屏幕截图工作正常,但视频则不然。

根据这个 GitHub 问题,指定singleFile: true是原因。将所有失败的测试保存到一个记录中时,路径模式不能使用单个测试或夹具标识符来命名文件。

以下模式占位符解析为包含单个文件的空字符串:

  • ${TEST_ID}
  • ${TEST_INDEX}
  • ${夹具}
  • ${测试}
  • ${TEST_ID}

路径模式的文档确实提到了单个文件的此限制,但仅引用 ${TEST_ID},而不是其他占位符。

我已经检查了场景,它在 Windows 10 下没有任何"路径模式"问题:

testcafe chrome test.js --video artifacts/videos --video-options pathPattern=${TEST}.mp4

您能否澄清一下您如何指定pathPattern视频选项?此外,请提供您的环境详细信息。

最新更新