Skip to content

[🐛 Bug]: waitForDisplayed({reverse:true}) flakiness in v9 #14835

@ivanovicu

Description

@ivanovicu

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.19.2

Node.js Version

20.11.1

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [{
        browserName: 'chrome',
        'goog:chromeOptions': {
            args: ['--disable-gpu', '--no-sandbox']
        }
    }],

What happened?

After closing a modal, custom command waitForNotDisplayed() which is wrapper around waitForDisplayed({reverse:true}) often still detects the element as displayed in WebdriverIO v9. It's not stable as it was in v8. In v9, the command frequently fails, still reporting the element as displayed.

While other custom command waitForNotExist() works consistently in both v8 and v9, waitForNotDisplayed does not.

Step 1: open a modal
Step 2: wait modal to display
Step 3: close modal
Step 4: wait modal not to be displayed

What is your expected behavior?

The command should reliably resolve once the modal is no longer visible. Also any stacktrace would help other than just pointing to the custom command.

How to reproduce the bug.

Minimal reproduction case for waitForNotDisplayed method issue.

Quick Start

# Clone
git clone https://github.com/ivanovicu/wdio_issue.git
cd wdio_issue

# Install
pnpm install

# Run test
for i in {1..10}; do pnpm test; done

Issue

The test clicks a button to open a modal, presses Escape to close it, then waits for the element to disappear using waitForNotDisplayed.

Expected: Element should not be seen as displayed

Requirements

  • Node.js v20.11.1
  • pnpm
  • Chrome browser

Relevant log output

element (".main-module_ms-main-bot__QKkRf") still displayed after 40000ms
[chrome 141.0.7390.123 mac #0-0] Error: element (".main-module_ms-main-bot__QKkRf") still displayed after 40000ms
[chrome 141.0.7390.123 mac #0-0]     at async Element.<anonymous> (file:///Users/urosivanovic/Desktop/Focus/wdio_issue/wdio.conf.js:29:4)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions