Skip to content

[BUG] Assertion of hover tips not working in headless mode #22862

@igdswzcd

Description

@igdswzcd

System info

  • Playwright Version: v1.33
  • Operating System: Windows 10
  • Browser: Chromium
  • Other info:

Issue Description

I want to verify the contents of tips when hovers over some locators.

  • Headed Mode
    • Locator is visible without scrolling: √
    • Locator needs scrolling & depends on hover() itself to scrollIntoView: ×
    • Locator needs scrolling & manually trigger scrollIntoView in advance: √
  • Headless Mode
    • First condition above: √
    • Last two items above: ×

Why the 3rd condition worked in Headed while not worked in Headless? How the scrollIntoVieW method works?

The element needs to be hovered is a bit special, it may not depend on :hover, having tested in Chrome DevTools: added force state to it but the content didn't appeared too, so it maybe binds to other listeners.

I wonder if there is a solution to deal with such condition? Could locator.hover()continuously triggers until expect() statements to be done?

Source code

Test file (self-contained)

await page.getBytext('other locator nearby to trigger scrollIntoView').click();
await expect(page.getByText('${tip}')).toHaveCount(0);
await page.locator('xxx-label:visible').locator('.tool-tip').hover();
await expect(page.getByText('${tip}')).toHaveCount(1);

Steps

  • Run the test

Expected

All passed

Actual

  • Headed Mode
    • Locator is visible without scrolling: √
    • Locator needs scrolling & depends on hover() itself to scrollIntoView: ×
    • Locator needs scrolling & manually trigger scrollIntoView in advance: √
  • Headless Mode
    • First condition above: √
    • Last two items above: ×

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