You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it becomes even more obvious what it means when having this style:
browser.all('.item').should(have.text('foo'))
It asserts that all items (collection of elements found by '.item' selector)
have same text - foo
So, it kind of similar (but more powerful):
for item in browser.all('.item'):
item.should(have.text('foo'))
This feature for collection's should to accept element conditions too, was added in Selene 2.0, because I found it's extremely readable and obvious from the context of "native english speaker".
But it happened that people often misuse the following cases:
browser.all('.item').should(have.text('foo'))
browser.all('.item').should(have.texts('foo'))
which a completely different
Even more often it happens when the ss style is used:
ss('.item').should(have.text('foo'))
ss('.item').should(have.texts('foo'))
So despite of the fact that this: browser.all('.item').should(have.text('foo')) – is the pure beauty to my taste:) – now I think we have to depracate this style... and don't allow for collection's should to accept element conditions...
This is even more becomes actual, because now I am not totally shure that the name browser.all is a perfect name... I realaized this when found that there are some usefull methods in collection that might interfere by meaning with this browser.all... Let's see how will it go further... But for now it seems like the style of selene 1.0 to have separate collection.should_each(element_condition) style was better (this should_each method is marked as deprecated for now).
So probably, at least we can come back to .should_each... Or... what about this style: collection.should(have.text('foo').each) ? Maybe it less readable, but then implementation of should method is simpler... Many things become more KISS inside Selene, making it easier to support and maintain....
The text was updated successfully, but these errors were encountered:
+ ... and ability to pass element_condition to `collection.should(HERE)`
- Use instead: `collection.should(element_condition.each)`
+ bump version to 2.0.0b13
+ update README.md for 2.0.0b12
Currently selene supports
it becomes even more obvious what it means when having this style:
It asserts that all items (collection of elements found by '.item' selector)
So, it kind of similar (but more powerful):
This feature for collection's should to accept element conditions too, was added in Selene 2.0, because I found it's extremely readable and obvious from the context of "native english speaker".
But it happened that people often misuse the following cases:
browser.all('.item').should(have.text('foo'))
browser.all('.item').should(have.texts('foo'))
which a completely different
Even more often it happens when the
ss
style is used:ss('.item').should(have.text('foo'))
ss('.item').should(have.texts('foo'))
So despite of the fact that this:
browser.all('.item').should(have.text('foo'))
– is the pure beauty to my taste:) – now I think we have to depracate this style... and don't allow for collection'sshould
to accept element conditions...This is even more becomes actual, because now I am not totally shure that the name
browser.all
is a perfect name... I realaized this when found that there are some usefull methods in collection that might interfere by meaning with this browser.all... Let's see how will it go further... But for now it seems like the style of selene 1.0 to have separatecollection.should_each(element_condition)
style was better (thisshould_each
method is marked as deprecated for now).So probably, at least we can come back to
.should_each
... Or... what about this style:collection.should(have.text('foo').each)
? Maybe it less readable, but then implementation of should method is simpler... Many things become more KISS inside Selene, making it easier to support and maintain....The text was updated successfully, but these errors were encountered: