Skip to content

Match the whole text in to_have_text - #402

Open
dominikklein wants to merge 1 commit into
YusukeIwaki:mainfrom
dominikklein:fix/to-have-text-full-match
Open

dominikklein wants to merge 1 commit into
YusukeIwaki:mainfrom
dominikklein:fix/to-have-text-full-match

Conversation

@dominikklein

Copy link
Copy Markdown

Fixes #401.

to_have_text passed match_substring: true, so it behaved like to_contain_text. This drops it for the single value and the array form, like Playwright for JS and Python do. to_contain_text stays as it is.

The docs example "✖ Last item does not match" (have_text(["Text 1", "Text 2", "Text"])) actually passed before, so the new spec uses that case too.

One example fixture relied on the old behaviour: it set the status to "Something Submitted!!" and checked have_text("Submitted"). I changed the fixture to "Submitted", which is also what the upstream docs example shows, and regenerated the docs page.

This can break suites that relied on substring matching, so it's probably worth a note in the release.

@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

@dominikklein is attempting to deploy a commit to the Yusuke Iwaki's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_have_text matches substrings like to_contain_text

1 participant