From dd99db2f9dd6ad626c4e881520f13abf8b39f7f5 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Wed, 28 Oct 2026 14:37:45 -0700 Subject: [PATCH 1/2] devops(ci): use the shared test environment action from microsoft/playwright The test steps run through EXEC from microsoft/playwright/.github/actions/test-env, which adds xvfb on Linux and normal I/O priority on Windows, so the Linux and non-Linux steps and the copy of windows-normal-io.ps1 go away. --- .github/workflows/ci.yml | 58 +++++++++++------------------------ scripts/windows-normal-io.ps1 | 44 -------------------------- 2 files changed, 18 insertions(+), 84 deletions(-) delete mode 100644 scripts/windows-normal-io.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e48cb0749..c39479d42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,8 +103,12 @@ jobs: python-version: '3.12' browser: chromium runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: microsoft/playwright/.github/actions/test-env@main - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: @@ -127,34 +131,17 @@ jobs: id: install run: python -m playwright install --with-deps ${{ matrix.browser }} - name: Common Tests - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/common --browser=${{ matrix.browser }} + run: $EXEC pytest tests/common --browser=${{ matrix.browser }} - name: Test Reference count - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }} + run: $EXEC pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }} - name: Test Wheel Installation - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/test_installation.py --browser=${{ matrix.browser }} - - name: Test Sync API - if: runner.os != 'Linux' - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $EXEC pytest tests/test_installation.py --browser=${{ matrix.browser }} - name: Test Sync API - if: runner.os == 'Linux' - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $EXEC pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - name: Test Async API # Also after a failed sync step: the two suites report on their own. - if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os != 'Linux' }} - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - - name: Test Async API - if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os == 'Linux' }} - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + run: $EXEC pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes test-stable: name: Stable @@ -173,8 +160,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/test-env@main - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: @@ -197,26 +188,13 @@ jobs: id: install run: python -m playwright install ${{ matrix.browser-channel }} --with-deps - name: Common Tests - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} + run: $EXEC pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} - name: Test Sync API - if: runner.os != 'Linux' - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - - name: Test Sync API - if: runner.os == 'Linux' - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $EXEC pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - name: Test Async API # Also after a failed sync step: the two suites report on their own. - if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os != 'Linux' }} - run: | - ${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }} - pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - - name: Test Async API - if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os == 'Linux' }} - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + if: ${{ !cancelled() && steps.install.outcome == 'success' }} + run: $EXEC pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes test_examples: name: Examples 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)" From 55d4741fb8680d2b53665d0227ef1d074d8bfa85 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Wed, 28 Oct 2026 15:43:03 -0700 Subject: [PATCH 2/2] devops(ci): rename the shared action to ci-env and EXEC to CI_ENV_EXEC --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c39479d42..240afe8f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: microsoft/playwright/.github/actions/test-env@main + - uses: microsoft/playwright/.github/actions/ci-env@main - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: @@ -131,17 +131,17 @@ jobs: id: install run: python -m playwright install --with-deps ${{ matrix.browser }} - name: Common Tests - run: $EXEC pytest tests/common --browser=${{ matrix.browser }} + run: $CI_ENV_EXEC pytest tests/common --browser=${{ matrix.browser }} - name: Test Reference count - run: $EXEC pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }} + run: $CI_ENV_EXEC pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }} - name: Test Wheel Installation - run: $EXEC pytest tests/test_installation.py --browser=${{ matrix.browser }} + run: $CI_ENV_EXEC pytest tests/test_installation.py --browser=${{ matrix.browser }} - name: Test Sync API - run: $EXEC pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $CI_ENV_EXEC pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - name: Test Async API # Also after a failed sync step: the two suites report on their own. if: ${{ !cancelled() && steps.install.outcome == 'success' }} - run: $EXEC pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $CI_ENV_EXEC pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes test-stable: name: Stable @@ -165,7 +165,7 @@ jobs: shell: bash steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: microsoft/playwright/.github/actions/test-env@main + - uses: microsoft/playwright/.github/actions/ci-env@main - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: @@ -188,13 +188,13 @@ jobs: id: install run: python -m playwright install ${{ matrix.browser-channel }} --with-deps - name: Common Tests - run: $EXEC pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} + run: $CI_ENV_EXEC pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} - name: Test Sync API - run: $EXEC pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $CI_ENV_EXEC pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes - name: Test Async API # Also after a failed sync step: the two suites report on their own. if: ${{ !cancelled() && steps.install.outcome == 'success' }} - run: $EXEC pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes + run: $CI_ENV_EXEC pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes test_examples: name: Examples