Skip to content

Commit a50a6c6

Browse files
committed
Fix Chrome tests in GitHub Actions workflow
1 parent b053ba2 commit a50a6c6

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

.github/workflows/dart.yml

+16-19
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13-
# Note that this workflow uses the latest stable version of the Dart SDK.
14-
# Docker images for other release channels - like dev and beta - are also
15-
# available. See https://hub.docker.com/r/google/dart/ for the available
16-
# images.
17-
container:
18-
image: dart:beta
19-
2013
steps:
2114
- uses: actions/checkout@v4
22-
15+
16+
- name: Setup Dart
17+
uses: dart-lang/setup-dart@v1
18+
with:
19+
sdk: beta
20+
2321
- name: Print Dart SDK version
2422
run: dart --version
2523

@@ -36,15 +34,14 @@ jobs:
3634
- name: Run VM tests
3735
run: dart test -p vm
3836

39-
# Tests on Chrome
40-
- name: Install Chrome
41-
run: |
42-
apt-get update
43-
apt-get install -y wget gnupg
44-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
45-
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
46-
apt-get update
47-
apt-get install -y google-chrome-stable
48-
37+
# Tests on Chrome - using browser-tools setup action
38+
- name: Setup Chrome
39+
uses: browser-actions/setup-chrome@latest
40+
with:
41+
chrome-version: stable
42+
4943
- name: Run Chrome tests
50-
run: dart test -p chrome --chrome-flags="--no-sandbox"
44+
run: |
45+
# Use DART_TEST_CHROME_OPTIONS instead of CHROME_FLAGS
46+
export DART_TEST_CHROME_OPTIONS="--no-sandbox --disable-gpu --headless --disable-dev-shm-usage"
47+
dart test -p chrome

run_chrome_tests.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Set Chrome options to match the GitHub workflow configuration
4+
export DART_TEST_CHROME_OPTIONS="--no-sandbox --disable-gpu --headless --disable-dev-shm-usage"
5+
6+
# Run the tests with Chrome platform
7+
echo "Running Chrome tests with DART_TEST_CHROME_OPTIONS: $DART_TEST_CHROME_OPTIONS"
8+
dart test -p chrome
9+
10+
# Exit with the test command's exit code
11+
exit $?

0 commit comments

Comments
 (0)