Skip to content

🎥 Make videos programmatically with React

Internal: Use the bundled Media test browser

Jonny Burger67ebf7984710
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 67a9cc14ee..b1b29fdad0 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -329,6 +329,9 @@ jobs:
run: bun ci
- name: Cache Turbo
uses: rharkor/[email protected]
+ - name: Install Media browser
+ if: matrix.os == 'macos-latest' && needs.affected.outputs.build == 'true'
+ run: cd packages/media && bunx playwright install --with-deps chromium
- name: Build & Test
if: needs.affected.outputs.build == 'true'
timeout-minutes: 30
@@ -338,6 +341,15 @@ jobs:
if: matrix.os == 'ubuntu-latest' && needs.affected.outputs.bundle_example == 'true'
run: |
bunx turbo run bundle-testbed --filter=@remotion/example --no-update-notifier
+ - name: Upload Media test failures
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: media-test-failures-${{ matrix.os }}-node-${{ matrix.node_version }}-${{ github.run_attempt }}
+ path: packages/media/.vitest/attachments
+ include-hidden-files: true
+ if-no-files-found: ignore
+ retention-days: 7
required-ci:
name: Required CI
if: ${{ always() }}
diff --git a/packages/media/src/test/__screenshots__/player-loop-frame-accuracy.test.tsx/media-player-frame-1711-video-frame-91-loop-trim-after-step-back-chromium.png b/packages/media/src/test/__screenshots__/player-loop-frame-accuracy.test.tsx/media-player-frame-1711-video-frame-91-loop-trim-after-step-back-chromium.png
index 0c344a7b51..6ab5f3463e 100644
Binary files a/packages/media/src/test/__screenshots__/player-loop-frame-accuracy.test.tsx/media-player-frame-1711-video-frame-91-loop-trim-after-step-back-chromium.png and b/packages/media/src/test/__screenshots__/player-loop-frame-accuracy.test.tsx/media-player-frame-1711-video-frame-91-loop-trim-after-step-back-chromium.png differ
diff --git a/packages/media/src/test/browser.test.ts b/packages/media/src/test/browser.test.ts
index 370a8ed6e1..debfab8a71 100644
--- a/packages/media/src/test/browser.test.ts
+++ b/packages/media/src/test/browser.test.ts
@@ -62,6 +62,7 @@ test('Should be able to extract a frame', async () => {
const cacheStats = keyframeManager.getCacheStats();
expect(cacheStats.count).toBe(1);
+ frame.close();
});
test('Should be able to extract the last frame', async () => {
@@ -113,6 +114,7 @@ test('Should be able to extract the last frame', async () => {
const cacheStats = keyframeManager.getCacheStats();
expect(cacheStats.count).toBe(1);
+ frame.close();
});
test('Should manage the cache', async (t) => {
@@ -124,7 +126,7 @@ test('Should manage the cache', async (t) => {
keyframeManager.clearAll('info');
for (let i = 0; i < 50; i++) {
- await extractFrameAndAudio({
+ const result = await extractFrameAndAudio({
sampleRate: 48000,
src: `/bigbuckbunny.mp4?i=${i}`,
timeInSeconds: 1,
@@ -142,6 +144,9 @@ test('Should manage the cache', async (t) => {
credentials: undefined,
mediaCache: globalMediaCache,
});
+ if (result.type === 'success') {
+ result.frame?.close();
+ }
}
const cacheStats = keyframeManager.getCacheStats();
@@ -259,4 +264,5 @@ test('Should be able to loop', async () => {
const {frame} = result;
assert(frame);
+ frame.close();
});
diff --git a/packages/media/vitest.config.ts b/packages/media/vitest.config.ts
index ea98cccd1b..94581c244b 100644
--- a/packages/media/vitest.config.ts
+++ b/packages/media/vitest.config.ts
@@ -18,7 +18,7 @@ export default defineConfig({
test: {
fileParallelism: false,
browser: {
- provider: playwright({launchOptions: {channel: 'chrome'}}),
+ provider: playwright(),
instances: [{browser: 'chromium'}],
headless: true,
screenshotFailures: false,