Selenium Javascript - Headless mode record video

Viewed 11

I use selenium in javascript along with jest to do some end-to-end testing of an application. Eventually those tests runs in headless mode on Azure Pipelines

To help debugging, I would like to have a video record in case a test fails. I could not find any package which would work with jest and selenium.

I already managed to upload a screenshot in case of failure so I have takeScreenshot working.

For the video, I wanted to try to take a picture every second before "compiling" it with ffpmeg but I have a memory issue.

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Am I on the right track?

public async startRecording() {
    this.recording = true;
    let count = 1;
    let interval;
    while (this.recording) {
      interval = setInterval(async () => {
        await this.takeScreenshot(`test_${count}`);
        count += 1;
      }, 1000);
    }
    clearInterval(interval);
  }

  public stopRecording() {
    this.recording = false;
  }
0 Answers
Related