@@ -93,37 +93,66 @@ jobs:
93
93
uses : browser-actions/setup-chrome@latest
94
94
with :
95
95
chrome-version : stable
96
- env :
97
- 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"
98
96
- name : Run tests
99
97
env :
100
98
CHROME_HEADLESS : 1
101
99
CHROME_PATH : chrome
100
+ CHROME_FLAGS : " --enable-features=SharedArrayBuffer --headless --disable-gpu --no-sandbox --enable-experimental-web-platform-features --enable-features=SharedArrayBuffer"
102
101
HEADERS : ' {"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Embedder-Policy": "require-corp", "Cross-Origin-Resource-Policy": "cross-origin", "Origin-Agent-Cluster": "?1"}'
103
102
run : |
104
103
# Start test server with proper headers for all tests
105
104
npm run serve &
106
105
107
- # Wait for server to start
108
- sleep 5
106
+ # Wait for server to start and ensure headers are properly set
107
+ sleep 10
108
+
109
+ # Verify headers are set correctly
110
+ echo "Checking security headers..."
111
+ curl -I http://localhost:3000/tests/ffmpeg-core-st.test.html
112
+
113
+ # Check if cross-origin isolation is working
114
+ echo "Adding debug script to test files to check crossOriginIsolated status..."
115
+ for test_file in tests/ffmpeg-*.test.html; do
116
+ sed -i '/<\/head>/ i\<script>console.log("crossOriginIsolated status:", crossOriginIsolated);</script>' $test_file
117
+ done
109
118
110
- # Run all tests with proper headers
119
+ # Run single-threaded tests first
120
+ echo "Running single-threaded tests..."
111
121
npx mocha-headless-chrome \
112
122
--args="$CHROME_FLAGS" \
113
123
-a no-sandbox \
114
- -f http://localhost:3000/tests/ffmpeg-core-mt .test.html
124
+ -f http://localhost:3000/tests/ffmpeg-core-st .test.html 2>&1 | tee st-core-test.log
115
125
116
126
npx mocha-headless-chrome \
117
127
--args="$CHROME_FLAGS" \
118
128
-a no-sandbox \
119
- -f http://localhost:3000/tests/ffmpeg-core-st.test.html
129
+ -f http://localhost:3000/tests/ffmpeg-st.test.html 2>&1 | tee st-test.log
130
+
131
+ # Run multi-threaded tests with additional SharedArrayBuffer flags
132
+ echo "Running multi-threaded tests..."
133
+ CHROME_FLAGS="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation --cross-origin-isolated"
134
+
135
+ # Debug SharedArrayBuffer availability
136
+ echo "Testing SharedArrayBuffer availability..."
137
+ cat << EOF > debug-sab.js
138
+ console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
139
+ console.log('crossOriginIsolated:', crossOriginIsolated);
140
+ EOF
141
+ node debug-sab.js
120
142
121
143
npx mocha-headless-chrome \
122
144
--args="$CHROME_FLAGS" \
123
145
-a no-sandbox \
124
- -f http://localhost:3000/tests/ffmpeg-mt.test.html
146
+ -f http://localhost:3000/tests/ffmpeg-core- mt.test.html 2>&1 | tee mt-core-test.log
125
147
126
148
npx mocha-headless-chrome \
127
149
--args="$CHROME_FLAGS" \
128
150
-a no-sandbox \
129
- -f http://localhost:3000/tests/ffmpeg-st.test.html
151
+ -f http://localhost:3000/tests/ffmpeg-mt.test.html 2>&1 | tee mt-test.log
152
+
153
+ # Display all logs for debugging
154
+ echo "=== Test Logs ==="
155
+ for log in *-test.log; do
156
+ echo "Contents of $log:"
157
+ cat $log
158
+ done
0 commit comments