avh4 / elm-program-test

Test Elm programs
https://elm-program-test.netlify.com/
MIT License
93 stars 27 forks source link

clickButton should match (or prefer) full-text matches over substring matches #155

Open avh4 opened 2 years ago

avh4 commented 2 years ago
<body>
    <button>A</button>
    <button>Analyze</button>
</body>
ProgramTest.clickButton "A"

This should be able to pass, clicking the first button.

This is a shortcoming of https://package.elm-lang.org/packages/elm-explorations/test/latest/Test-Html-Selector#text afaik, Test.Html.Selector provides no way to distinguish full-text matches from substring matches, so I'm not sure there's a way to fix this without additions to elm-explorations/test.

Qluxzz commented 9 months ago

Just got bit by this as well, but from what I can see a exactText selector was added in this commit https://github.com/elm-explorations/test/commit/4f8a0344edd5be9d221e81f871f65c82a87c9e76 and released in 2.1.0 of elm-explortations/test.