Skip to content

Bug Report — not.toBeDisplayed() times out unless { wait: X } is provided #2048

@mcabare

Description

@mcabare

Issue Description
After upgrading to recent versions of expect-webdriverio (used with WebdriverIO 9.24.0), the following assertion consistently fails:
await expect(toto).not.toBeDisplayed();
The error returned is:
Error: Timeout of 120000ms exceeded.

However, these two variants work correctly:
await expect(toto).not.toBeDisplayed({ wait: 0 })
await expect(toto).not.toBeDisplayed({ wait: 200 })

This means the assertion only passes when an explicit wait option is provided, even though the element is already not displayed at the time of the check.

Expected Behavior
await expect(toto).not.toBeDisplayed()
➡ should pass without requiring { wait: X } when the element is already not visible.
According to the project documentation and recent changes to expect‑webdriverio, the .not modifier is supposed to wait for the negated condition to become true:

“.not should also wait for conditions (Breaking changes…)”
af8d5e5

Therefore, no additional { wait: X } parameter should be required.

Thank you in advance for looking into the issue.

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