Skip to content

🎥 Make videos programmatically with React

add retry to flaky tet

Jonny Burgera609585f3c80
diff --git a/packages/it-tests/src/ssr/render-media.test.ts b/packages/it-tests/src/ssr/render-media.test.ts
index 7f6907f8c1..3ea69bb523 100644
--- a/packages/it-tests/src/ssr/render-media.test.ts
+++ b/packages/it-tests/src/ssr/render-media.test.ts
@@ -4,40 +4,44 @@ import {existsSync} from 'fs';
import os from 'os';
import path from 'path';
-test('Render video with browser instance open', async () => {
- const puppeteerInstance = await openBrowser('chrome');
- const compositions = await getCompositions(
- 'https://661808694cad562ef2f35be7--incomparable-dasik-a4482b.netlify.app/',
- {
- puppeteerInstance,
- inputProps: {},
- },
- );
+test(
+ 'Render video with browser instance open',
+ async () => {
+ const puppeteerInstance = await openBrowser('chrome');
+ const compositions = await getCompositions(
+ 'https://661808694cad562ef2f35be7--incomparable-dasik-a4482b.netlify.app/',
+ {
+ puppeteerInstance,
+ inputProps: {},
+ },
+ );
- const reactSvg = compositions.find((c) => c.id === 'react-svg');
+ const reactSvg = compositions.find((c) => c.id === 'react-svg');
- if (!reactSvg) {
- throw new Error('not found');
- }
+ if (!reactSvg) {
+ throw new Error('not found');
+ }
- const tmpDir = os.tmpdir();
+ const tmpDir = os.tmpdir();
- const outPath = path.join(tmpDir, 'out.mp4');
+ const outPath = path.join(tmpDir, 'out.mp4');
- await renderMedia({
- outputLocation: outPath,
- codec: 'h264',
- serveUrl:
- 'https://661808694cad562ef2f35be7--incomparable-dasik-a4482b.netlify.app/',
- composition: reactSvg,
- frameRange: [0, 2],
- puppeteerInstance,
- metadata: {Author: 'Lunar'},
- logLevel: 'error',
- });
- await puppeteerInstance.close({silent: false});
- expect(existsSync(outPath)).toBe(true);
-});
+ await renderMedia({
+ outputLocation: outPath,
+ codec: 'h264',
+ serveUrl:
+ 'https://661808694cad562ef2f35be7--incomparable-dasik-a4482b.netlify.app/',
+ composition: reactSvg,
+ frameRange: [0, 2],
+ puppeteerInstance,
+ metadata: {Author: 'Lunar'},
+ logLevel: 'error',
+ });
+ await puppeteerInstance.close({silent: false});
+ expect(existsSync(outPath)).toBe(true);
+ },
+ {retry: 2},
+);
test('Render video with browser instance not open', async () => {
const compositions = await getCompositions(