javascriptautomated-testse2e-testingvideo-recordingtestcafe

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


EDITED

I'm facing this issue while trying to create test videos using the TestCase Javascript API.

I'm working with testcafe version 0.22.0 and I already have the prerequisites the request in their documentation.

Basically, the issue is video function doesn't exist in my runner object.

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


Solution

  • You are using the old TestCafe version. The 'Recording Video' feature appeared in a version older than 0.22.0. The latest TestCafe version (1.1.2) exactly contains this feature.