Skip to content

Use normalized string in getByText error if text not found #450

Closed
@Cerden

Description

@Cerden

Describe the feature you'd like:

When getByText fails to find text that has been normalized, the error message should show the normalized version of the string instead of the original.

Currently the error message shows the original un-normalized version. This can be confusing as often that exact text can be seen in the DOM logged out afterwards.

A downside is that it might not be immediately obvious why different text is being shown in the error from what was typed. IMO, if the user is unaware of the default normalization behaviour, this scenario makes it easier to track it down in the docs, and is slightly more representative of why the test is failing.

Describe alternatives you've considered:

Possible alternative is to generically mention normalisation in the error message (alongside text being split onto two lines)

Teachability, Documentation, Adoption, Migration Strategy:

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions