[QA] Reg::RSpec matchers

jagori samajdar jagori79 at gmail.com
Thu Jul 17 04:59:44 UTC 2014


Thanks a lot Dan,

Its clear now.As of now,I was seeing we are dealing with a page object
element and calling visible? method on that.

Regards,
Jagori


On Wed, Jul 16, 2014 at 12:01 PM, Dan Duvall <dduvall at wikimedia.org> wrote:

> > Thus expect(x).to be_visible
> > is basically calling x.visible? method.Hope I am right in my
> understanding.
>
> That's exactly right!
>
> > is visible? a method available by default from Ruby or is it a user
> defined function?
>
> (TL;DR: user defined)
>
> It completely depends on the subject of your test, so you'll have to know
> a little about the object you're dealing with in each case. For browser
> tests, you're usually dealing with some kind of PageObject element, so
> you'll want to reference the API documentation for PageObject
> <http://rubydoc.info/github/cheezy/page-object/> and WebDriver
> <http://watir.github.io/watir-webdriver/doc/>. (Zeljko might know of some
> API documentation that's easier to follow.) Alternatively, just try it and
> if you get a NoMethodError, the object doesn't respond to `visible?`.
>
> Hope this helps!
> Dan
>
>
> On Tue, Jul 15, 2014 at 6:13 PM, jagori samajdar <jagori79 at gmail.com>
> wrote:
>
>> Hi Dan,
>>
>> Thanks for sharing the article.I can correlate a bit now.I read about
>> predicate methods too about which I wasn't aware.
>>
>> Thus expect(x).to be_visible
>>
>> is basically calling x.visible? method.Hope I am right in my
>> understanding.
>>
>> Just one more question,might sound bit basic:)
>>
>> is visible? a method available by default from Ruby or is it a user
>> defined function?
>>
>> Thanks,
>> Jagori
>>
>>
>>
>> On Wed, Jul 16, 2014 at 10:55 AM, jagori samajdar <jagori79 at gmail.com>
>> wrote:
>>
>>> Thanks Dan,yup I was reading that only now:)
>>>
>>>
>>> On Wed, Jul 16, 2014 at 10:39 AM, Dan Duvall <dduvall at wikimedia.org>
>>> wrote:
>>>
>>>> Got it! I was confused about what you were confused about then. :)
>>>>
>>>> If you're still wondering about the absence of `be_visible` in the
>>>> RSpec documentation, do check out the link to predicate matchers I
>>>> posted.[1]
>>>>
>>>>
>>>> https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/built-in-matchers/predicate-matchers
>>>>
>>>>
>>>>
>>>> On Tue, Jul 15, 2014 at 5:01 PM, jagori samajdar <jagori79 at gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks Dan,I understand and am aware of that.
>>>>>
>>>>> It was just for my knowledge and understanding.Since am pretty new to
>>>>> Ruby and Watir-Webdriver,so am trying to learn whatever things I come
>>>>> across while making the changes.
>>>>>
>>>>> Thanks ,
>>>>> Jagori
>>>>>
>>>>>
>>>>> On Wed, Jul 16, 2014 at 3:12 AM, Dan Duvall <dduvall at wikimedia.org>
>>>>> wrote:
>>>>>
>>>>>> Just to clarify, AFAIK the predicate matcher
>>>>>> <https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/built-in-matchers/predicate-matchers>
>>>>>> syntax has not changed, so there's no need to change `be_visible`. As
>>>>>> Zeljko has illustrated, it's only the expectation syntax
>>>>>> <https://www.relishapp.com/rspec/rspec-expectations/docs> that needs
>>>>>> refactoring.
>>>>>>
>>>>>>
>>>>>> On Tue, Jul 15, 2014 at 1:07 AM, jagori samajdar <jagori79 at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Thanks Zeljko for helping me out with the conversion part.I was
>>>>>>> thinking , how to convert a single line statement like this:)
>>>>>>>
>>>>>>> But I still remain confused about the documentation.
>>>>>>>
>>>>>>> If anybody could provide any other documentation would be wonderful.
>>>>>>> Thanks,
>>>>>>> jagori
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jul 14, 2014 at 10:21 PM, Željko Filipin <
>>>>>>> zfilipin at wikimedia.org> wrote:
>>>>>>>
>>>>>>>> On Mon, Jul 14, 2014 at 11:28 AM, jagori samajdar <
>>>>>>>> jagori79 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> As part of my task wherein am converting the should syntax to
>>>>>>>>> expect,am bit confused with the *be_visible* matcher or whatever
>>>>>>>>> it is.
>>>>>>>>>
>>>>>>>>
>>>>>>>> For those of you that are not familiar with the bug, it is 66369[1].
>>>>>>>>
>>>>>>>>
>>>>>>>>> I couldn't see it anywhere in the RSpec's default built in matcher
>>>>>>>>> list.
>>>>>>>>> https://github.com/rspec/rspec-expectations
>>>>>>>>>
>>>>>>>>> Can anyone help me understand the same as in the pasted code
>>>>>>>>> defined in options_steps.rb:
>>>>>>>>>
>>>>>>>>> Then(/^I should see the options overlay$/) do
>>>>>>>>>
>>>>>>>>> on(VisualEditorPage).options_page_title_element.when_present.should
>>>>>>>>> be_visible
>>>>>>>>> end
>>>>>>>>>
>>>>>>>>
>>>>>>>> In this case, you have to convert
>>>>>>>>
>>>>>>>> on(VisualEditorPage).options_page_title_element.when_present.should
>>>>>>>> be_visible
>>>>>>>>
>>>>>>>> to
>>>>>>>>
>>>>>>>>
>>>>>>>> expect((VisualEditorPage).options_page_title_element.when_present).to be_visible
>>>>>>>>
>>>>>>>> Let me know if you are still confused, or if you need more
>>>>>>>> documentation. If anybody can point to better documentation than I have
>>>>>>>> provided in the last e-mail message, please do.
>>>>>>>>
>>>>>>>> Željko
>>>>>>>> --
>>>>>>>> https://bugzilla.wikimedia.org/show_bug.cgi?id=66369
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> QA mailing list
>>>>>>>> QA at lists.wikimedia.org
>>>>>>>> https://lists.wikimedia.org/mailman/listinfo/qa
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> QA mailing list
>>>>>>> QA at lists.wikimedia.org
>>>>>>> https://lists.wikimedia.org/mailman/listinfo/qa
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dan Duvall
>>>>>> Automation Engineer
>>>>>> Wikimedia Foundation <http://wikimediafoundation.org>
>>>>>>
>>>>>> _______________________________________________
>>>>>> QA mailing list
>>>>>> QA at lists.wikimedia.org
>>>>>> https://lists.wikimedia.org/mailman/listinfo/qa
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> QA mailing list
>>>>> QA at lists.wikimedia.org
>>>>> https://lists.wikimedia.org/mailman/listinfo/qa
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Dan Duvall
>>>> Automation Engineer
>>>> Wikimedia Foundation <http://wikimediafoundation.org>
>>>>
>>>> _______________________________________________
>>>> QA mailing list
>>>> QA at lists.wikimedia.org
>>>> https://lists.wikimedia.org/mailman/listinfo/qa
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> QA mailing list
>> QA at lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/qa
>>
>>
>
>
> --
> Dan Duvall
> Automation Engineer
> Wikimedia Foundation <http://wikimediafoundation.org>
>
> _______________________________________________
> QA mailing list
> QA at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/qa
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20140717/67544c9a/attachment.html>


More information about the QA mailing list