视频路径问题

Issues with video path

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

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

According to the documentation,这应该有效,但会显示以下警告:

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);

正如我所说,屏幕截图效果很好,但视频却不行。

我已经检查了场景,它在 Windows 10:

下没有任何 "path pattern" 问题
testcafe chrome test.js --video artifacts/videos --video-options pathPattern=${TEST}.mp4

能否说明一下您是如何指定 pathPattern video option 的?此外,请提供您的环境详细信息。

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

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

  • ${TEST_ID}
  • ${TEST_INDEX}
  • ${FIXTURE}
  • ${测试}
  • ${TEST_ID}

documentation for the path patterns 确实提到了针对单个文件的此限制,但仅针对 ${TEST_ID} 而不是其他占位符。