Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for custom output filenames and temp files in subfolders #3

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Dreamdealer
Copy link

@Dreamdealer Dreamdealer commented Apr 2, 2021

To implement this package in our e2e tests I made some changes:

  • Each test recording gets its own subfolder for the images and the images.txt file
  • Each recording can get an optional name

This is how we implemented it in our e2e env. It starts a recording for each it in a test. When the test succeeds the video is not rendered and the temp dir is cleared. When a test fails, the video is compiled and the temp dir is also cleared. At the end of all tests the recording/ folder only contains the .webm video files of failed tests.

We then upload these videos together with the test results to slack using a github action.

global.it = async function(name, func) {
    return await test(name, async () => {
        const recorder = new PuppeteerVideoRecorder();
        await recorder.init(page, `recording/`, `${name}-${Date.now()}`);
        await recorder.start();

        try {
            await func();
            await recorder.cancel();
            await recorder.clear();
        } catch (error) {
            await recorder.stop();
            await recorder.clear();
            throw error;
        }
    });
};

@shaynet10

@CarloPalinckx
Copy link

@shaynet10 could you have a look at this? 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants