Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/actions/run-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@ runs:
run: |
if [[ "$(uname)" == "Linux" ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- ${{ inputs.command }}
elif [[ "$RUNNER_OS" == "Windows" ]]; then
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .github/actions/run-test/windows-normal-io.ps1 -RunBashCommand
else
${{ inputs.command }}
fi
shell: bash
env:
PW_TAG: "@${{ inputs.bot-name }}"
PW_TEST_COMMAND: ${{ inputs.command }}
- name: Run tests
if: inputs.shell != 'bash'
run: ${{ inputs.command }}
run: |
${{ runner.os == 'Windows' && (inputs.shell == 'pwsh' || inputs.shell == 'powershell') && '. .\.github\actions\run-test\windows-normal-io.ps1' || '' }}
${{ inputs.command }}
shell: ${{ inputs.shell }}
env:
PW_TAG: "@${{ inputs.bot-name }}"
Expand Down
47 changes: 47 additions & 0 deletions .github/actions/run-test/windows-normal-io.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
param([switch]$RunBashCommand)

$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)"

if ($RunBashCommand) {
& "$env:ProgramFiles\Git\bin\bash.exe" --noprofile --norc -eo pipefail -c $env:PW_TEST_COMMAND
exit $LASTEXITCODE
}
12 changes: 9 additions & 3 deletions tests/library/browsercontext-reuse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ for (const scenario of ['launch', 'connect'] as const) {
await expect(page).toHaveTitle('Page Title');
});

test('BC-076 should not cache resources', async ({ reusedContext, server }) => {
test('BC-076 should not cache resources', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43704' } }, async ({ reusedContext, server }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/19926' });
const requestCountMap = new Map<string, number>();
server.setRoute('/page.html', (req, res) => {
Expand Down Expand Up @@ -235,7 +235,10 @@ for (const scenario of ['launch', 'connect'] as const) {
{
const context = await reusedContext();
const page = await context.newPage();
await page.goto(server.PREFIX + '/page.html');
await Promise.all([
page.waitForResponse(server.PREFIX + '/simple.json'),
page.goto(server.PREFIX + '/page.html'),
]);
await expect(page).toHaveTitle('Count: 0');
expect(requestCountMap.get('/page.html')).toBe(1);
expect(requestCountMap.get('/style.css')).toBe(1);
Expand All @@ -244,7 +247,10 @@ for (const scenario of ['launch', 'connect'] as const) {
{
const context = await reusedContext();
const page = context.pages()[0];
await page.goto(server.PREFIX + '/page.html');
await Promise.all([
page.waitForResponse(server.PREFIX + '/simple.json'),
page.goto(server.PREFIX + '/page.html'),
]);
await expect(page).toHaveTitle('Count: 1');
expect(requestCountMap.get('/page.html')).toBe(2);
expect(requestCountMap.get('/style.css')).toBe(2);
Expand Down
Loading