Skip to content

🎥 Make videos programmatically with React

test everywhere

Jonny Burgercddee08e2177
diff --git a/packages/webcodecs/.gitignore b/packages/webcodecs/.gitignore
new file mode 100644
index 0000000000..87364a273f
--- /dev/null
+++ b/packages/webcodecs/.gitignore
@@ -0,0 +1 @@
+test-results
diff --git a/packages/webcodecs/playwright.config.ts b/packages/webcodecs/playwright.config.ts
new file mode 100644
index 0000000000..842312c1a1
--- /dev/null
+++ b/packages/webcodecs/playwright.config.ts
@@ -0,0 +1,18 @@
+import {defineConfig, devices} from '@playwright/test';
+
+export default defineConfig({
+ projects: [
+ {
+ name: 'chromium',
+ use: {...devices['Desktop Chrome']},
+ },
+ {
+ name: 'firefox',
+ use: {...devices['Desktop Firefox']},
+ },
+ {
+ name: 'webkit',
+ use: {...devices['Desktop Safari']},
+ },
+ ],
+});
diff --git a/packages/webcodecs/src/it-tests/resample-audiodata.test.ts b/packages/webcodecs/src/it-tests/resample-audiodata.test.ts
index c7fcaa89f0..6038e24c60 100644
--- a/packages/webcodecs/src/it-tests/resample-audiodata.test.ts
+++ b/packages/webcodecs/src/it-tests/resample-audiodata.test.ts
@@ -1,24 +1,18 @@
+import type {Page} from '@playwright/test';
import {test} from '@playwright/test';
import {execSync} from 'node:child_process';
-import {chromium} from 'playwright';
-const runTest = async (entrypoint: string) => {
+const runTest = async (entrypoint: string, page: Page) => {
const bundled = execSync(`bun build ${entrypoint}`);
- const browser = await chromium.launch({headless: true}); // Set headless: true to run in headless mode
- const page = await browser.newPage();
-
await page.goto('about:blank');
-
await page.evaluate(bundled.toString('utf8'));
-
- await browser.close();
};
-test('should downsample audio data', async () => {
- await runTest(__dirname + '/downsample-audiodata.ts');
+test('should downsample audio data', async ({page}) => {
+ await runTest(__dirname + '/downsample-audiodata.ts', page);
});
-test('should upsample audio data', async () => {
- await runTest(__dirname + '/upsample-audiodata.ts');
+test('should upsample audio data', async ({page}) => {
+ await runTest(__dirname + '/upsample-audiodata.ts', page);
});