Skip to content

Commit bd3a7b8

Browse files
committed
reconfigure tests environment
1 parent af7f279 commit bd3a7b8

File tree

3 files changed

+63
-27
lines changed

3 files changed

+63
-27
lines changed

.github/workflows/CI.yml

+60-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,67 @@ jobs:
8989
node-modules-
9090
- name: Install dependencies
9191
run: npm install
92+
- name: Install Chrome
93+
uses: browser-actions/setup-chrome@latest
94+
with:
95+
chrome-version: stable
9296
- name: Install Chrome dependencies
9397
run: |
9498
sudo apt-get update
95-
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
99+
sudo apt-get install -y \
100+
libgbm-dev \
101+
libasound2 \
102+
libatk1.0-0 \
103+
libc6 \
104+
libcairo2 \
105+
libcups2 \
106+
libdbus-1-3 \
107+
libexpat1 \
108+
libfontconfig1 \
109+
libgcc1 \
110+
libgdk-pixbuf2.0-0 \
111+
libglib2.0-0 \
112+
libgtk-3-0 \
113+
libnspr4 \
114+
libpango-1.0-0 \
115+
libpangocairo-1.0-0 \
116+
libstdc++6 \
117+
libx11-6 \
118+
libx11-xcb1 \
119+
libxcb1 \
120+
libxcomposite1 \
121+
libxcursor1 \
122+
libxdamage1 \
123+
libxext6 \
124+
libxfixes3 \
125+
libxi6 \
126+
libxrandr2 \
127+
libxrender1 \
128+
libxss1 \
129+
libxtst6 \
130+
libgbm1
131+
- name: Set Chrome flags
132+
run: |
133+
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
96134
- name: Run tests
97-
run: npm test
135+
env:
136+
CHROME_HEADLESS: 1
137+
CHROME_PATH: chrome
138+
run: |
139+
# Start test server with proper headers
140+
npm run serve &
141+
142+
# Wait for server to be ready
143+
npx wait-on http://localhost:3000
144+
145+
# Run tests with configured Chrome flags
146+
npx mocha-headless-chrome \
147+
--args="$CHROME_FLAGS" \
148+
-a no-sandbox \
149+
--chrome-path="$(which chrome)" \
150+
-f http://localhost:3000/tests/ffmpeg-core-mt.test.html
151+
152+
# Run remaining tests
153+
npm run test:browser:core:st
154+
npm run test:browser:ffmpeg:mt
155+
npm run test:browser:ffmpeg:st

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"lint:root": "eslint tests",
88
"build": "npm run build --workspace=packages --if-present",
99
"pretest": "npm run build",
10-
"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\"}'",
10+
"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\"}'",
1111
"test": "server-test test:browser:server 3000 test:all",
1212
"test:all": "npm-run-all test:browser:*:*",
13-
"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",
13+
"test:browser": "mocha-headless-chrome --args=\"$CHROME_FLAGS\" -a no-sandbox",
1414
"test:browser:core:mt": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-core-mt.test.html",
1515
"test:browser:core:st": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-core-st.test.html",
1616
"test:browser:ffmpeg:mt": "npm run test:browser -- -f http://localhost:3000/tests/ffmpeg-mt.test.html",
@@ -20,8 +20,7 @@
2020
"test:node:core:mt": "npm run test:node -- --require tests/test-helper-mt.js tests/ffmpeg-core.test.js",
2121
"test:node:core:st": "npm run test:node -- --require tests/test-helper-st.js tests/ffmpeg-core.test.js",
2222
"prepublishOnly": "npm run build",
23-
"postinstall": "npm run build",
24-
"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"
23+
"postinstall": "npm run build"
2524
},
2625
"workspaces": [
2726
"packages/*",

tests/environment-check.test.html

-21
This file was deleted.

0 commit comments

Comments
 (0)