From e8558ffd9c38a2686c93b9714f0b7da5f4e81732 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 25 May 2026 07:58:19 +0200 Subject: [PATCH] Attempt to fix CI tests running --- .github/workflows/test.yml | 12 ++++++++++++ cli/integration_test.go | 5 +++++ server/servertest/servertest.go | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 105d562d..b44144ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,12 +58,24 @@ jobs: npm ci make build + - name: Install Playwright Chromium (with system deps) + run: npx playwright install --with-deps chromium + + - name: Resolve Chromium path + id: chromium + run: | + echo "path=$(node -e 'console.log(require("@playwright/test").chromium.executablePath())')" >> "$GITHUB_OUTPUT" + - name: Run Go tests + env: + SB_CHROME_PATH: ${{ steps.chromium.outputs.path }} run: | go test ./server/... -v -timeout 300s go test ./cli/... -v -timeout 300s - name: Run Go tests with coverage + env: + SB_CHROME_PATH: ${{ steps.chromium.outputs.path }} run: go test ./server/... ./cli/... -coverprofile=coverage.out -timeout 300s - name: Display test coverage diff --git a/cli/integration_test.go b/cli/integration_test.go index c25aff56..d55aff95 100644 --- a/cli/integration_test.go +++ b/cli/integration_test.go @@ -65,9 +65,14 @@ func startSharedServer() (*servertest.TestServer, func()) { } ts.Config.HeadlessToken = hex.EncodeToString(b) + chromePath := os.Getenv("SB_CHROME_PATH") + if chromePath == "" { + chromePath = os.Getenv("CHROMIUM_PATH") + } hb, err := server.StartHeadlessBrowser(&server.HeadlessConfig{ ServerURL: ts.Server.URL, HeadlessToken: ts.Config.HeadlessToken, + ChromePath: chromePath, }) if err != nil { panic("headless browser should start: " + err.Error()) diff --git a/server/servertest/servertest.go b/server/servertest/servertest.go index c031c024..6e8ecb8e 100644 --- a/server/servertest/servertest.go +++ b/server/servertest/servertest.go @@ -10,6 +10,7 @@ import ( "encoding/hex" "net/http" "net/http/httptest" + "os" "path/filepath" "runtime" "testing" @@ -147,9 +148,14 @@ func StartHeadless(t *testing.T, opts ...Option) *TestServer { ts.Config.HeadlessToken = hex.EncodeToString(b) } + chromePath := os.Getenv("SB_CHROME_PATH") + if chromePath == "" { + chromePath = os.Getenv("CHROMIUM_PATH") + } hb, err := server.StartHeadlessBrowser(&server.HeadlessConfig{ ServerURL: ts.Server.URL, HeadlessToken: ts.Config.HeadlessToken, + ChromePath: chromePath, }) require.NoError(t, err, "headless browser should start") t.Cleanup(hb.Stop)