Skip to content

E2E testing and tooltip hover #5701

@luixo

Description

@luixo

Provide a general summary of the issue here

Hello,
I'm using tooltip from @nextui-org/react that uses @react-aria/tooltip internally (specifically useTooltipTrigger).
While trying to verify that tooltip opens in my tests (using playwright) I stumbled upon tooltip not getting opened on hover while testing.

The diff that is happening is that the tooltip state always has prop open: false and never shows up in playwright's browser.
It is happening because of the useTooltipTriggers onHoverStart function that checks interactionModality and doesn't open tooltip if it's not pointer.

Real browser sets interactionModality to pointer whenever hover is happening on a document, but testing software doesn't happen to do that.
When I add additional clicking in the browser before first hover - it works as intended.

🤔 Expected Behavior?

I expect playwright's browser hover make tooltip open - without additional clicking.

😯 Current Behavior

Tooltip is not opened if no click (move?) was made before in playwright.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Add a tooltip on a page
  2. (in playwright test) Hover the tooltip
  3. (in playwright test) Verify tooltip exists

Version

3.20.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

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