Skip to content

[BUG] expect.configure timeout does not apply to expect.poll #28744

@aldeed

Description

@aldeed

System info

  • Playwright Version: v1.40.1
  • Operating System: All
  • Browser: n/a

Source code

import { expect } from "@playwright/test";

// Create a custom expect with 10s timeout
const customExpect = expect.configure({ timeout: 10000 });

// This fails because it actually logs
// "Timeout 5000ms exceeded while waiting on the predicate"
await expect(
  customExpect
    .poll(async () => {
      return true;
    })
    .toBe(false),
).rejects.toThrow(/Timeout 10000ms exceeded/);

Steps

  • Run the code and notice that the assertion fails. Here's a codesandbox link where you can try it.

Expected

The timeout of 10s should be respected, and the error message should say "Timeout 10000ms exceeded..."

The docs do not explicitly say this should work, but expect.configure is immediately before this section in the docs so it seems to imply it. Also, this PR does explicitly say it should work.

Actual

The built-in default timeout of 5s is used, and the error message says "Timeout 5000ms exceeded..."

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions