Version
1.57.0
Steps to reproduce
npm install @playwright/test@1.57.0
playwright.config.ts:
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: '.',
use: {
reducedMotion: 'reduce'
}
});
repro.spec.ts:
import { test, expect } from '@playwright/test';
test('use.reducedMotion from config is honored by the runner context', async ({ page }) => {
await page.setContent('<p>hello</p>');
const matches = await page.evaluate(() =>
matchMedia('(prefers-reduced-motion: reduce)').matches
);
expect(matches).toBe(true);
});
npx playwright test
Expected behavior
The test passes: matchMedia('(prefers-reduced-motion: reduce)') is true inside pages of the runner-managed browser context, because the config sets use.reducedMotion: 'reduce'.
Actual behavior
The test fails: matchMedia returns false. The option is silently not applied — neither from the config's top-level use nor from an explicit test.use({ reducedMotion: 'reduce' }) in the spec file.
Notably, a manually created context in the same test run honors the option:
test('probe', async ({ browser }) => {
const ctx = await browser.newContext({ reducedMotion: 'reduce' });
const page = await ctx.newPage();
console.log(await page.evaluate(() => matchMedia('(prefers-reduced-motion: reduce)').matches)); // true
});
So the emulation itself works — the runner appears to drop reducedMotion when building the context for the page fixture. As a workaround, await page.emulateMedia({ reducedMotion: 'reduce' }) per page works.
Impact: tests relying on reduced-motion emulation (e.g. axe-core accessibility scans that must not run mid-animation) behave differently than the config suggests and become timing-flaky.
Additional context
- Browser: chromium (default project, headless shell 143.0.7499.4)
- Only tested with the default
chromium project; no project-level use overrides involved (plain devices['Desktop Chrome'] does not change the outcome either).
Environment
System:
OS: macOS 26.x (arm64, Apple Silicon)
CPU: Apple M-series
Binaries:
Node: 22.22.3
npm/bun: bun 1.3.14
npmPackages:
@playwright/test: 1.57.0
Version
1.57.0
Steps to reproduce
npm install @playwright/test@1.57.0playwright.config.ts:repro.spec.ts:npx playwright testExpected behavior
The test passes:
matchMedia('(prefers-reduced-motion: reduce)')istrueinside pages of the runner-managed browser context, because the config setsuse.reducedMotion: 'reduce'.Actual behavior
The test fails:
matchMediareturnsfalse. The option is silently not applied — neither from the config's top-levelusenor from an explicittest.use({ reducedMotion: 'reduce' })in the spec file.Notably, a manually created context in the same test run honors the option:
So the emulation itself works — the runner appears to drop
reducedMotionwhen building the context for thepagefixture. As a workaround,await page.emulateMedia({ reducedMotion: 'reduce' })per page works.Impact: tests relying on reduced-motion emulation (e.g. axe-core accessibility scans that must not run mid-animation) behave differently than the config suggests and become timing-flaky.
Additional context
chromiumproject; no project-leveluseoverrides involved (plaindevices['Desktop Chrome']does not change the outcome either).Environment