Collection.matching(be.present) returns True if empty
SanKolts opened this issue · comments
SanKolts commented
Following code
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').matching(be.present)
returns True
but it should be False
This leads to situations when
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').should(be.present)
passes
and
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').should(be.absent)
fails.
Iakiv Kramarenko commented
Hm... That's an interesting case...
Actually be.present is not a "collection condition", it is not supposed to
be called on browser.all(selector).should(HERE)
You even should get a warning in IDE like PyCharm.
To achieve what you want you are supposed to use have.size*
But the case is yet interesting... Maybe we should consider allowing users
to have conditions that can be called both on single element and collection
of elements. Just... This is pretty complicated thing to analyze and
investigate all edge cases. For this definitely not a bug... Yet I'll think
what to do to make API even more friendly and natural, yet powerful and
straightforward.
…On Mon, Jan 2, 2023, 13:24 SanKolts ***@***.***> wrote:
Following code
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').matching(be.present)
returns
True
But it should be
False
This leads to situations when
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').should(be.present)
passes
and
browser.all('.some-random-and-for-sure-is-not-presented-in-a-dom-class').should(be.absent)
fails.
—
Reply to this email directly, view it on GitHub
<#465>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAO6ZHQTIGMZYIVIDWNWR5TWQK3HHANCNFSM6AAAAAATOXPIHI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>