Yes, that would work. Personally, I find "falsey" hard to type. Technically it also includes "nil", though #present? shouldn't return that. I tend to go with:
expect(on(MyAccountPage).reward_history?).to eq false The monkey patch is redefining the method. It's one of those good and bad things that Ruby lets you do. Justin On Thursday, January 31, 2019 at 6:18:51 PM UTC-5, NaviHan wrote: > > Thanks Justin for creating a feature request. > > What I have done is I have created a file name monkeypatch.rb and put the > code you have given in there. > Changed the script to use and it passed. > > expect(on(MyAccountPage).reward_history?).to be_falsey > > Could you please confirm if this is the right way to do this. > > By the way Im confused how the script know it has to give priority to > standard_methods in the monkypatch.rb rather in the actual PageObject > module? > > > On Friday, 1 February 2019 00:11:33 UTC+11, NaviHan wrote: >> >> I have an element defined as >> >> div(:reward_history, :class => 'reward-history-header') >> >> >> The page-object gem generated four methods for this element which are >> >> >> 'reward_history', 'reward_history_element', and 'reward_history?' >> >> >> >> The fourth method 'reward_history?' check if the element exists in the >> DOM? >> >> >> But what if the element exists in the DOM but is hidden, which is >> basically checking if the element is present? >> >> >> Is there an autogenerated method for this? >> >> I tried 'reward_history(:&present?)' but didn't work >> >> As of now I have to write a method separately which does this >> >> def is_reward_history_present? >> return reward_history_element.present? >> end >> >> >> >> -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
