Skip to content

Commit d5ba164

Browse files
authored
Add flags to run Chrome with WebGL on CI (#2721)
Today the tests CI running in Chrome started to fail with such an error: ``` TypeError: Cannot read properties of undefined (reading 'getParameter') at <global>._glGetString(skiko.mjs:8) ``` We noticed that github runner got an updated Chrome version. But downgrading didn't help. So we set additional flags for Chrome launcher. ## Testing N/A ## Release Notes N/A
1 parent 63daa4c commit d5ba164

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

.github/workflows/compose-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ jobs:
191191
strategy:
192192
fail-fast: false
193193
matrix:
194-
chrome: [ '118', 'stable' ]
194+
chrome: [ '134', 'stable' ]
195195
task: [ 'Js', 'Wasm' ]
196196
steps:
197197
- name: Checkout Repository
@@ -208,6 +208,7 @@ jobs:
208208
209209
- name: Setup Google Chrome
210210
uses: browser-actions/setup-chrome@v2
211+
id: setup-chrome
211212
with:
212213
chrome-version: ${{ matrix.chrome }}
213214
install-chromedriver: true
@@ -220,7 +221,8 @@ jobs:
220221
221222
- name: Run Web Chrome Tests
222223
run: |
223-
./gradlew :mpp:testWeb${{ matrix.task }} \
224+
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns && \
225+
CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }} ./gradlew :mpp:testWeb${{ matrix.task }} \
224226
--no-daemon --stacktrace --no-parallel \
225227
-Pjetbrains.androidx.web.tests.enableFirefox=false \
226228
-Pjetbrains.androidx.web.tests.enableChrome=true
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2026 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package androidx.compose.ui
18+
19+
import kotlin.test.Test
20+
import kotlin.test.assertNotNull
21+
import kotlin.test.assertTrue
22+
import kotlinx.browser.document
23+
import org.w3c.dom.HTMLCanvasElement
24+
25+
class ATestToCheckWebGLContext {
26+
27+
@Test
28+
fun test() {
29+
val canvas = document.createElement("canvas") as HTMLCanvasElement
30+
document.body!!.appendChild(canvas)
31+
val webGl2 = canvas.getContext("webgl2")
32+
println("WebGl2 = " + webGl2 + "\n")
33+
34+
var hasWeglContext = webGl2 != null
35+
if (webGl2 == null) {
36+
println("WebGl2 is not supported")
37+
val webgl1 = canvas.getContext("webgl")
38+
println("WebGl1 = " + webgl1 + "\n")
39+
hasWeglContext = webgl1 != null
40+
}
41+
42+
canvas.remove()
43+
44+
assertTrue(hasWeglContext, "Expected hasWeglContext to be true, but was - $hasWeglContext")
45+
}
46+
}

mpp/karma.config.d/web/commonKarmaConfig.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ function configLaunchers(config) {
33
config.customLaunchers = {
44
ChromeForComposeTests: {
55
base: "Chrome",
6-
flags: ["--no-sandbox", "--disable-search-engine-choice-screen"]
6+
flags: [
7+
"--no-sandbox",
8+
"--disable-search-engine-choice-screen",
9+
10+
// "CI-stabilizer" :D - otherwise webgl2 context is null:
11+
"--disable-setuid-sandbox",
12+
"--enable-webgl",
13+
"--ignore-gpu-blocklist",
14+
"--in-process-gpu"
15+
]
716
},
817
ChromiumForComposeTests: {
918
base: "Chromium"

0 commit comments

Comments
 (0)