diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9d09d59412..df088bfe3a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -89,9 +89,67 @@ jobs: node-modules- - name: Install dependencies run: npm install + - name: Install Chrome + uses: browser-actions/setup-chrome@latest + with: + chrome-version: stable - name: Install Chrome dependencies run: | sudo apt-get update - sudo apt-get install -y libgbm-dev libasound2t64 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libgbm1 + sudo apt-get install -y \ + libgbm-dev \ + libasound2 \ + libatk1.0-0 \ + libc6 \ + libcairo2 \ + libcups2 \ + libdbus-1-3 \ + libexpat1 \ + libfontconfig1 \ + libgcc1 \ + libgdk-pixbuf2.0-0 \ + libglib2.0-0 \ + libgtk-3-0 \ + libnspr4 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ + libstdc++6 \ + libx11-6 \ + libx11-xcb1 \ + libxcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxext6 \ + libxfixes3 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libxss1 \ + libxtst6 \ + libgbm1 + - name: Set Chrome flags + run: | + echo "CHROME_FLAGS=--enable-features=SharedArrayBuffer,CrossOriginIsolation --enable-experimental-web-platform-features --cross-origin-isolated --allow-file-access-from-files --disable-web-security --allow-insecure-localhost --no-sandbox --disable-setuid-sandbox --enable-unsafe-webgpu --disable-gpu-sandbox" >> $GITHUB_ENV - name: Run tests - run: npm test + env: + CHROME_HEADLESS: 1 + CHROME_PATH: chrome + run: | + # Start test server with proper headers + npm run serve & + + # Wait for server to be ready + npx wait-on http://localhost:3000 + + # Run tests with configured Chrome flags + npx mocha-headless-chrome \ + --args="$CHROME_FLAGS" \ + -a no-sandbox \ + --chrome-path="$(which chrome)" \ + -f http://localhost:3000/tests/ffmpeg-core-mt.test.html + + # Run remaining tests + npm run test:browser:core:st + npm run test:browser:ffmpeg:mt + npm run test:browser:ffmpeg:st diff --git a/package.json b/package.json index f89d63ee6b..d45be4ef06 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "lint:root": "eslint tests", "build": "npm run build --workspace=packages --if-present", "pretest": "npm run build", - "serve": "http-server -c-1 -s -p 3000 . --cors --headers '{\"Cross-Origin-Embedder-Policy\":\"require-corp\",\"Cross-Origin-Opener-Policy\":\"same-origin\",\"Cross-Origin-Resource-Policy\":\"cross-origin\"}'", + "serve": "http-server -c-1 -s -p 3000 . --cors --headers '{\"Cross-Origin-Embedder-Policy\":\"require-corp\",\"Cross-Origin-Opener-Policy\":\"same-origin\",\"Cross-Origin-Resource-Policy\":\"cross-origin\",\"Origin-Agent-Cluster\":\"?1\"}'", "test": "server-test test:browser:server 3000 test:all", "test:all": "npm-run-all test:browser:*:*", - "test:browser": "mocha-headless-chrome --args=\"--enable-features=SharedArrayBuffer --enable-experimental-web-platform-features --cross-origin-isolated --allow-file-access-from-files --disable-web-security --allow-insecure-localhost --no-sandbox --disable-setuid-sandbox\" -a no-sandbox", + "test:browser": "mocha-headless-chrome --args=\"$CHROME_FLAGS\" -a no-sandbox", "test:browser:core:mt": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-core-mt.test.html", "test:browser:core:st": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-core-st.test.html", "test:browser:ffmpeg:mt": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-mt.test.html", @@ -20,8 +20,7 @@ "test:node:core:mt": "npm run test:node -- --require tests/test-helper-mt.js tests/ffmpeg-core.test.js", "test:node:core:st": "npm run test:node -- --require tests/test-helper-st.js tests/ffmpeg-core.test.js", "prepublishOnly": "npm run build", - "postinstall": "npm run build", - "test:environment": "npm run serve & wait-on http://localhost:3000 && mocha-headless-chrome --args=\"--enable-features=SharedArrayBuffer --enable-experimental-web-platform-features --cross-origin-isolated --allow-file-access-from-files\" -a no-sandbox -f http://localhost:3000/tests/environment-check.test.html" + "postinstall": "npm run build" }, "workspaces": [ "packages/*", diff --git a/tests/environment-check.test.html b/tests/environment-check.test.html deleted file mode 100644 index 10ca4d9847..0000000000 --- a/tests/environment-check.test.html +++ /dev/null @@ -1,21 +0,0 @@ - - -
- -