TestCafe runner.video 不是 createTestCafe.then.then.remoteConnection 的函数

TestCafe runner.video is not a function at createTestCafe.then.then.remoteConnection

已编辑

我在尝试使用 TestCase Javascript API.

创建测试视频时遇到了这个问题

我正在使用 testcafe 版本 0.22.0,并且我已经在他们的文档中拥有请求的先决条件。

基本上,问题是我的跑步者对象中不存在视频功能。

https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#record-videos

createTestCafe('localhost', 1337, 1338)
    .then(testcafe => {
        runner = testcafe.createRunner();
        return testcafe.createBrowserConnection();
    })
    .then(remoteConnection => {
        // Outputs remoteConnection.url so that it can be visited from the remote browser.
            runner
                .video(artifactsPath, true)
                .src(specsPath + '/run-animation.spec.ts')
                .browsers(['chrome'])
                .reporter('json')
                .run()
                .then(failedCount => {
                    console.log('Error: ', failedCount);
                })
                .catch(error => {
                    console.log('Error: ', error);
                });
    });

您使用的是旧版 TestCafe。 “Recording Video”功能出现在早于 0.22.0 的版本中。 最新的 TestCafe 版本 (1.1.2) 正好包含此功能。