Skip to content

Commit

Permalink
reconfigure tests environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasgelfond committed Dec 24, 2024
1 parent af7f279 commit bd3a7b8
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 27 deletions.
62 changes: 60 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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/*",
Expand Down
21 changes: 0 additions & 21 deletions tests/environment-check.test.html

This file was deleted.

0 comments on commit bd3a7b8

Please sign in to comment.