Skip to content

Agent DX improvement: Container locators can't read their rendered text #155

Description

@peholmst

Problem. SpanLocator has getText(). DialogLocator has open(),
close(), getComponent() — and no way to read what the dialog says. For a
modal editor test ("the live line total shows €37.50", "the error summary lists
this message") the natural assertion is on the dialog's text, and it needs the
component:

// Wanted (either shape)
assertThat(findDialog().getTextRecursively()).contains("€37.50");
assertThat(findDialog().getText()).contains("€37.50");

// Actual
assertThat(findDialog().getComponent().getElement().getTextRecursively())
        .contains("€37.50");

Locator.inside(Locator) does let you scope a typed child lookup
(findSpan().inside(findDialog())), which covers some cases well — but it can't
express "assert over everything this container renders", and inside() isn't
mentioned anywhere an author would look (see ticket 6).

Ask. Add getText() / getTextRecursively() to locators for
container-shaped components (Dialog, ConfirmDialog, Popover, Details,
Notification, plus the layout locators from ticket 3). Alternatively expose
getElement() on the base Locator so the escape hatch is at least uniform.

Copied from https://github.com/vaadin/agentic-dx-improvement/issues/107

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