From 1d2379181e0d4308f88eeb5473e4c674b54d91e2 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 8 May 2026 12:00:51 -0700 Subject: [PATCH 1/2] chore: align test_docker container launch with playwright-browsers Mirrors the docker run flags used by microsoft/playwright-browsers' tests-docker.yml so the Java and Node test environments stay in sync. - run as pwuser (--user=pwuser --workdir /home/pwuser) instead of root - explicit --platform linux/ - drop --ipc=host; set --shm-size=2g instead - deliver the repo via docker cp + chown rather than a bind mount, and move the image-baked /root/.m2 into pwuser's home so the locally-installed SNAPSHOT artifacts resolve - paths /root/playwright -> /home/pwuser/playwright This is expected to fix the probabilistic chrome-headless-shell SIGSEGV crashes observed on jammy in CI. --- .github/workflows/test_docker.yml | 35 ++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index b1249a5ed..d5672e169 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -28,24 +28,49 @@ jobs: matrix: flavor: [jammy, noble] runs-on: [ubuntu-24.04, ubuntu-24.04-arm] + include: + - runs-on: ubuntu-24.04 + arch: amd64 + - runs-on: ubuntu-24.04-arm + arch: arm64 steps: - uses: actions/checkout@v6 - name: Build Docker image run: | - ARCH="${{ matrix.runs-on == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }}" - bash utils/docker/build.sh --$ARCH ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }} + bash utils/docker/build.sh --${{ matrix.arch }} ${{ matrix.flavor }} playwright-java:localbuild-${{ matrix.flavor }} - name: Start container run: | - CONTAINER_ID=$(docker run --rm -e CI -e PW_MAX_RETRIES --ipc=host -v "$(pwd)":/root/playwright --name playwright-docker-test -d -t playwright-java:localbuild-${{ matrix.flavor }} /bin/bash) + CONTAINER_ID=$(docker run \ + --rm \ + --name playwright-docker-test \ + --platform linux/${{ matrix.arch }} \ + --user=pwuser \ + --workdir /home/pwuser \ + --shm-size=2g \ + -e CI \ + -e PW_MAX_RETRIES \ + -d -t \ + playwright-java:localbuild-${{ matrix.flavor }} /bin/bash) echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV + - name: Copy repository inside docker container + run: | + docker cp . "$CONTAINER_ID":/home/pwuser/playwright + # /root/.m2 was populated as root during image build; move it to + # pwuser so the locally-installed SNAPSHOT artifacts resolve. + docker exec --user root "$CONTAINER_ID" bash -c ' + chown -R pwuser /home/pwuser/playwright + mv /root/.m2 /home/pwuser/.m2 + chown -R pwuser /home/pwuser/.m2 + ' + - name: Run test in container run: | - docker exec "$CONTAINER_ID" /root/playwright/tools/test-local-installation/create_project_and_run_tests.sh + docker exec "$CONTAINER_ID" /home/pwuser/playwright/tools/test-local-installation/create_project_and_run_tests.sh - name: Test ClassLoader run: | - docker exec "${CONTAINER_ID}" /root/playwright/tools/test-spring-boot-starter/package_and_run_async_test.sh + docker exec "${CONTAINER_ID}" /home/pwuser/playwright/tools/test-spring-boot-starter/package_and_run_async_test.sh - name: Stop container run: | From 2b8392caf0764241f3d4d86d15ab06ad1d8c8671 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 8 May 2026 12:40:48 -0700 Subject: [PATCH 2/2] chore: tag a smoke subset and run only those in test_docker Mirrors the microsoft/playwright tests-docker.yml setup: the Docker workflow runs only the @smoke subset (Docker compatibility check), leaving the full suite for the regular CI matrix on native runners. Five representative test classes get a class-level @Tag("smoke"), giving ~5 chromium launches when surefire is invoked with -Dgroups=smoke: - TestBrowser1 (7 tests) - TestBrowserContextBasic (22 tests) - TestPageBasic (33 tests) - TestLocatorClick (5 tests) - TestSelectorsCss (20 tests) create_project_and_run_tests.sh forwards extra args to mvn so callers can pass -Dgroups=smoke. test_docker.yml runs only the smoke subset. --- .github/workflows/test_docker.yml | 4 ++-- .../src/test/java/com/microsoft/playwright/TestBrowser1.java | 2 ++ .../com/microsoft/playwright/TestBrowserContextBasic.java | 2 ++ .../test/java/com/microsoft/playwright/TestLocatorClick.java | 2 ++ .../src/test/java/com/microsoft/playwright/TestPageBasic.java | 2 ++ .../test/java/com/microsoft/playwright/TestSelectorsCss.java | 2 ++ tools/test-local-installation/create_project_and_run_tests.sh | 2 +- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index d5672e169..050787796 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -64,9 +64,9 @@ jobs: chown -R pwuser /home/pwuser/.m2 ' - - name: Run test in container + - name: Run smoke tests in container run: | - docker exec "$CONTAINER_ID" /home/pwuser/playwright/tools/test-local-installation/create_project_and_run_tests.sh + docker exec "$CONTAINER_ID" /home/pwuser/playwright/tools/test-local-installation/create_project_and_run_tests.sh -Dgroups=smoke - name: Test ClassLoader run: | diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowser1.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowser1.java index 938aebd35..4d3ef7203 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowser1.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowser1.java @@ -20,6 +20,7 @@ import com.google.gson.JsonObject; import com.microsoft.playwright.junit.FixtureTest; import com.microsoft.playwright.junit.UsePlaywright; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIf; @@ -30,6 +31,7 @@ @FixtureTest @UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class) +@Tag("smoke") public class TestBrowser1 { @Test diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java index 29aa3de77..f78dd8703 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java @@ -18,6 +18,7 @@ import com.microsoft.playwright.junit.FixtureTest; import com.microsoft.playwright.junit.UsePlaywright; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.io.OutputStreamWriter; @@ -32,6 +33,7 @@ @FixtureTest @UsePlaywright(TestOptionsFactories.BasicOptionsFactory.class) +@Tag("smoke") public class TestBrowserContextBasic { @Test void shouldCreateNewContext(Browser browser) { diff --git a/playwright/src/test/java/com/microsoft/playwright/TestLocatorClick.java b/playwright/src/test/java/com/microsoft/playwright/TestLocatorClick.java index eed425bcc..7359ccc54 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestLocatorClick.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestLocatorClick.java @@ -17,12 +17,14 @@ package com.microsoft.playwright; import com.microsoft.playwright.options.KeyboardModifier; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.assertEquals; +@Tag("smoke") public class TestLocatorClick extends TestBase { @Test diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java b/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java index feb3c0ab4..e9c1fa7b2 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledIf; @@ -30,6 +31,7 @@ import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.*; +@Tag("smoke") public class TestPageBasic extends TestBase { @Test diff --git a/playwright/src/test/java/com/microsoft/playwright/TestSelectorsCss.java b/playwright/src/test/java/com/microsoft/playwright/TestSelectorsCss.java index b1442d23a..6d553c4db 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestSelectorsCss.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestSelectorsCss.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -24,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.*; +@Tag("smoke") public class TestSelectorsCss extends TestBase { @Test diff --git a/tools/test-local-installation/create_project_and_run_tests.sh b/tools/test-local-installation/create_project_and_run_tests.sh index 525ca924f..99b2570bd 100755 --- a/tools/test-local-installation/create_project_and_run_tests.sh +++ b/tools/test-local-installation/create_project_and_run_tests.sh @@ -14,6 +14,6 @@ cp -R ../../driver-bundle/src/test/ $PROJECT_DIR/src/ cp -R ../../playwright/src/test/ $PROJECT_DIR/src/ cd $PROJECT_DIR -mvn test --no-transfer-progress +mvn test --no-transfer-progress "$@" rm -rf $PROJECT_DIR