Closed tesk9 closed 2 years ago
(also -- I thought this would be issue 144, and clearly it's not. Sorry for the confusing naming)
Does it work in https://package.elm-lang.org/packages/avh4/elm-program-test/3.6.2/ ?
Or more accurately: the given test passes again in 3.6.2. Are there now any additional new errors you get on your test suite?
Yes, there are more errors -- I'm working to try to isolate them. I think at least one of the new errors should be happening. It looks like potentially a previously-passing test should have been failing. I should have some (hopefully not too messy) results to share soon!
Ah yeah, the new expected errors would be if there's both a <button>
and a <something role="button">
that both match the same text, that will now be an error but would previously pass. (To fix, you'd need to use within
to narrow the search scope.)
Lmk about others. Feel free to start issues that are messy or just have a rough sentence sort of about what's failing or just the "pleaseReport:" line, since that might be enough for me to guess what's wrong.
Okay! So one of the tests that's failing seems to be finding a partial match ("Jeff Smith_3") for the button text that we're actually trying to click ("3") inside of a disabled menu component (the contents of the menu are in the DOM, but have properties like aria-hidden="true"
on them.
I think the error parsing maybe has a mistake in it? It seems like "Query.find always expects to find 1 element, but it found 2 instead." is a result that elm-program-test should expect to get.
The 2 matches are both real buttons.
--
Edit: I can definitely work around this, now that I know what's wrong with it.
=>
I think elm-program-test 3.6.1 introduced a new bug around finding clickable "buttons".
For html that includes an arbitrary element with
role="button"
, elm-program-test'sclickButton
works great unless there's also a regular button in the view as well.So a test like this one:
Produces a failure like this:
I committed this test on a fork of elm-program-test here: https://github.com/tesk9/elm-program-test/tree/issue-144/3-6-1
I also added the same test against 3.6.0 to demo what the behavior used to be here: https://github.com/tesk9/elm-program-test/tree/issue-144/3-6-0
cc @Arkham.