Skip to content

[Bug]: {auto: true} fixtures don't run unless connected to the active fixture graph #38830

Closed

Description

@BarSabo

Version

1.56.1

Steps to reproduce

Minimal Reproduction

import { test as base } from '@playwright/test';

const test = base.extend<{
  autoFixtureA: void;
  autoFixtureB: void;
}>({
  // This DOES run - depends on `context` (core fixture)
  autoFixtureA: [
    async ({ context }, use) => {
      console.log('autoFixtureA running');
      await use();
    },
    { scope: 'test', auto: true }
  ],

  // This does NOT run - no dependencies
  autoFixtureB: [
    async ({}, use) => {
      console.log('autoFixtureB running');
      await use();
    },
    { scope: 'test', auto: true }
  ],
});

test('test auto fixtures', async ({ page }) => {
  // Only "autoFixtureA running" appears in console
  // "autoFixtureB running" never appears
  await page.goto('https://example.com');
});

Workaround:
Adding a core fixture like context as a dependency (even if unused) makes the auto fixture run:

autoFixtureB: [
    async ({ context }, use) => {  // Adding context makes it work
      console.log('autoFixtureB running');
      await use();
    },
    { scope: 'test', auto: true }
  ],

Expected behavior

According to the https://playwright.dev/docs/test-fixtures#automatic-fixtures:
"Automatic fixtures are set up for each test/worker, even when the test does not list them directly."
I expected a fixture with auto: true to run automatically for every test, regardless of its dependencies.

Actual behavior

Actual Behavior

A fixture with auto: true only runs if:

  1. It depends on a "core" fixture like context or page, OR
  2. Another fixture in the test's dependency chain depends on it

A standalone auto: true fixture with no dependencies, or one that only depends on custom fixtures, does not run.

Additional context

  1. Is this the intended behavior?
  2. If so, could the documentation be updated to clarify that auto: true fixtures must be connected to the active fixture graph?

Environment

- Playwright version: "@playwright/test": "1.56.1",
- OS: macOS
- Node.js version: v22.12.0

Activity

  1. Skn0tt commented on Jan 19, 2026

    @Skn0tt
    Contributor

    Hi, could you share a reproduction repository with us? The snippet you share works fine for me, so there's probably something outside the snippet that plays into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions