🎥 Make videos programmatically with React
add retry for the flaky test
Igor Samokhovets736f1fd014ce
diff --git a/packages/media/src/test/looping.test.ts b/packages/media/src/test/looping.test.tsindex 0bed60c432..56ea0d1a11 100644--- a/packages/media/src/test/looping.test.ts+++ b/packages/media/src/test/looping.test.ts@@ -9,43 +9,47 @@ const trimAfter = 200;const playbackRate = 2;const loop = true;-test('when looping with a lot of concurrency, it must be frame-accurate', async () => {- const letInputTimestamps = [197, 198, 199, 200, 201, 202];- const realTimestamps = [];- const outputTimestamps = [];+test(+ 'when looping with a lot of concurrency, it must be frame-accurate',+ {retry: 3},+ async () => {+ const letInputTimestamps = [197, 198, 199, 200, 201, 202];+ const realTimestamps = [];+ const outputTimestamps = [];- for (const timeInFrames of letInputTimestamps) {- const realTimestamp = getTimeInSeconds({- fps,- loop,- mediaDurationInSeconds: 10,- playbackRate,- src: 'https://remotion.media/video.mp4',- trimAfter,- trimBefore,- unloopedTimeInSeconds: timeInFrames / fps,- ifNoMediaDuration: 'fail',- });- realTimestamps.push(realTimestamp);+ for (const timeInFrames of letInputTimestamps) {+ const realTimestamp = getTimeInSeconds({+ fps,+ loop,+ mediaDurationInSeconds: 10,+ playbackRate,+ src: 'https://remotion.media/video.mp4',+ trimAfter,+ trimBefore,+ unloopedTimeInSeconds: timeInFrames / fps,+ ifNoMediaDuration: 'fail',+ });+ realTimestamps.push(realTimestamp);- const result = await extractFrame({- src: 'https://remotion.media/video.mp4',- timeInSeconds: timeInFrames / fps,- logLevel: 'info',- loop,- trimAfter,- trimBefore,- playbackRate,- fps,- maxCacheSize: getMaxVideoCacheSize('info'),- });- expect(result.type).toBe('success');- assert(result.type === 'success');- outputTimestamps.push(result.frame?.timestamp ?? 0);- }+ const result = await extractFrame({+ src: 'https://remotion.media/video.mp4',+ timeInSeconds: timeInFrames / fps,+ logLevel: 'info',+ loop,+ trimAfter,+ trimBefore,+ playbackRate,+ fps,+ maxCacheSize: getMaxVideoCacheSize('info'),+ });+ expect(result.type).toBe('success');+ assert(result.type === 'success');+ outputTimestamps.push(result.frame?.timestamp ?? 0);+ }- expect(realTimestamps).toEqual([- 7.76, 7.84, 7.92, 4, 4.079999999999998, 4.16,- ]);- expect(outputTimestamps).toEqual([7.76, 7.84, 7.92, 4, 4.08, 4.16]);-});+ expect(realTimestamps).toEqual([+ 7.76, 7.84, 7.92, 4, 4.079999999999998, 4.16,+ ]);+ expect(outputTimestamps).toEqual([7.76, 7.84, 7.92, 4, 4.08, 4.16]);+ },+);