[wtr-general] Re: How to check if a collection is present in PageObject?

2019-03-27 Thread Justin Ko
If there are no matching elements, you should get an empty Array: p page.products_on_wishlist_elements.class #=> Array p page.products_on_wishlist_elements #=> [] Justin On Wednesday, March 27, 2019 at 8:18:45 AM UTC-4, NaviHan wrote: > > Hi Titus > > I read a wondeful article about the enumera

[wtr-general] Re: How to check if a collection is present in PageObject?

2019-03-27 Thread NaviHan
Hi Titus I read a wondeful article about the enumerable methods, Any, All, None & One. https://www.rubyguides.com/2018/10/any-all-none-one/ For the particular example in the first post, I used the below code to just return if wishlist is empty(No buttons are present on the wishlist page) and

[wtr-general] Re: How to check if a collection is present in PageObject?

2019-03-26 Thread NaviHan
Oops I thought because in a case where the wishlist is empty (i:e no buttons on wishlist page) the buttons are undefined. So thats not the case? When the page class is loaded all the elements are declared or what? Thsi si equivalent to doing on irb a.any? without declaring a as a = [ ] irb(mai