[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-04-16 Thread NaviHan
Hi Justin Sorry to comeback on this thread. Today I was just trying to understand this piece of code. I have also read your thread here https://stackoverflow.com/questions/36192357/is-there-a-way-to-define-a-text-field-element-type-that-does-send-key-as-default-set Im confused about the methods

[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-02-02 Thread Justin Ko
Hi, 1. The monkey patch is redefining the method. Last definition wins. It is how Ruby is designed, nothing specific to Page-Object. A simpler isolated example: def a 'hi' end def a 'bye' end puts a #=> "bye" Notice that you can define the method twice, but when called, the last

[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-02-01 Thread NaviHan
Thanks Justin.. I have two more question though. 1. How does the the method in monkey_path.b takes precedence over the method in actual page-object gem? 2. There are may intances in the application where a div element receives the click rather than a button. eg

[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-02-01 Thread Justin Ko
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

[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-01-31 Thread NaviHan
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

[wtr-general] Re: Is there an autogenerated method in page-object that tell if the element is present?

2019-01-31 Thread Justin Ko
You are correct that #reward_history? calls #exists?. There is no auto-generated method for #present?. It is rather unfortunate. Checking presence is probably more common than checking existence. As a backwards incompatible change, it'll take some time to change. If you want, you could