diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74bb73e1b..ecd7c0bfa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,8 +19,12 @@ jobs: os: [playwright-x64-ubuntu24-64-core, playwright-x64-server2025-64-core, macos-26-xlarge] browser: [chromium, firefox, webkit] runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: microsoft/playwright/.github/actions/ci-env@main - name: Set up JDK 1.8 uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 with: @@ -34,15 +38,11 @@ jobs: - name: Install browsers run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml --no-transfer-progress - name: Run tests - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - ${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24"' || '' }} mvn test --no-transfer-progress --fail-at-end ${{ runner.os == 'Windows' && '-D junit.parallel.factor=0.25' || '' }} -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss + run: $CI_ENV_EXEC mvn test --no-transfer-progress --fail-at-end ${{ runner.os == 'Windows' && '-D junit.parallel.factor=0.25' || '' }} -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss env: BROWSER: ${{ matrix.browser }} - name: Run tracing tests w/ sources - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - ${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24"' || '' }} mvn test --no-transfer-progress --fail-at-end --projects=playwright -D test=*TestTracing* -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss + run: $CI_ENV_EXEC mvn test --no-transfer-progress --fail-at-end --projects=playwright -D test=*TestTracing* -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss env: BROWSER: ${{ matrix.browser }} PLAYWRIGHT_JAVA_SRC: src/test/java @@ -66,8 +66,12 @@ jobs: - os: playwright-x64-server2025-64-core browser-channel: msedge runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: microsoft/playwright/.github/actions/ci-env@main - name: Install Media Pack if: runner.os == 'Windows' shell: powershell @@ -85,9 +89,7 @@ jobs: - name: Install browsers run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml --no-transfer-progress - name: Run tests - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - ${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24"' || '' }} mvn test --no-transfer-progress --fail-at-end ${{ runner.os == 'Windows' && '-D junit.parallel.factor=0.25' || '' }} -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss + run: $CI_ENV_EXEC mvn test --no-transfer-progress --fail-at-end ${{ runner.os == 'Windows' && '-D junit.parallel.factor=0.25' || '' }} -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss env: BROWSER: chromium BROWSER_CHANNEL: ${{ matrix.browser-channel }} @@ -101,6 +103,7 @@ jobs: runs-on: playwright-x64-ubuntu24-64-core steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: microsoft/playwright/.github/actions/ci-env@main - name: Set up JDK 25 uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0 with: @@ -117,7 +120,7 @@ jobs: - name: Install browsers run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml --no-transfer-progress - name: Run tests - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" mvn test --no-transfer-progress --fail-at-end + run: $CI_ENV_EXEC mvn test --no-transfer-progress --fail-at-end env: BROWSER: ${{ matrix.browser }} - name: Test Spring Boot Starter diff --git a/scripts/windows-normal-io.ps1 b/scripts/windows-normal-io.ps1 deleted file mode 100644 index f1308b638..000000000 --- a/scripts/windows-normal-io.ps1 +++ /dev/null @@ -1,44 +0,0 @@ -# Dot-source at the start of a Windows test step: the self-hosted runner starts steps at -# I/O priority Low, which the driver and the browsers inherit, and Firefox storage flushes -# then stall until tests time out. See https://github.com/microsoft/playwright/issues/43704. - -$ErrorActionPreference = 'Stop' - -Add-Type -TypeDefinition @' -using System; -using System.Runtime.InteropServices; - -public static class TestProcessIOPriority { - [DllImport("ntdll.dll")] - public static extern int NtSetInformationProcess( - IntPtr process, int informationClass, ref int information, int size); - - [DllImport("ntdll.dll")] - public static extern int NtQueryInformationProcess( - IntPtr process, int informationClass, out int information, int size, out int length); -} -'@ - -$priority = 0 -$length = 0 -$status = [TestProcessIOPriority]::NtQueryInformationProcess( - [IntPtr](-1), 33, [ref]$priority, 4, [ref]$length) -if ($status -ne 0) { - throw ('Reading I/O priority failed: NTSTATUS 0x{0:X8}' -f $status) -} -$inheritedPriority = $priority -$priority = 2 -$status = [TestProcessIOPriority]::NtSetInformationProcess( - [IntPtr](-1), 33, [ref]$priority, 4) -if ($status -ne 0) { - throw ('Setting normal I/O priority failed: NTSTATUS 0x{0:X8}' -f $status) -} -$status = [TestProcessIOPriority]::NtQueryInformationProcess( - [IntPtr](-1), 33, [ref]$priority, 4, [ref]$length) -if ($status -ne 0) { - throw ('Reading I/O priority failed: NTSTATUS 0x{0:X8}' -f $status) -} -if ($priority -ne 2) { - throw "Expected normal I/O priority (2), got $priority" -} -Write-Host "Test launcher I/O priority: $inheritedPriority -> $priority (Normal)"