[QA] Reg::Page Objects
Chris McMahon
cmcmahon at wikimedia.org
Mon May 19 15:40:53 UTC 2014
Hi Jagori,
We discussed this a little last week, and now that you've written this
report, I remember why we made the Links test work this way.
On Mon, May 19, 2014 at 6:31 AM, jagori samajdar <jagori79 at gmail.com> wrote:
>
> Certain elements like span which have been defined as below in
> visualeditor_page.rb
>
> span(:linksuggestion, text: "http://www.example.com")
> same for:
> span(:newpage_linksuggestion, text: "DoesNotExist")
>
> I was wondering if suppose I want to reuse these elements ,would I have to
> define a separate element since identification is by text and changing text
> might cause the other existing tests to fail.
>
> But wouldn't adding another element lead to redundancy.
>
These linksuggestion elements are spans whose only identifier other than
their text is class="oo-ui-labeledElement-label". The problem is that this
identifier is also used for many many other elements in the page, so
figuring which of the spans with class="oo-ui-labeledElement-label" is the
correct span for the test was challenging. Ultimately we decided that text
was the most reliable identifier, and that means that each of the links to
be tested needed its own page element, and also its own step in the
steps.rb file.
So if you follow the existing convention for the links test then yes, you
would need to add a new element in visual_editor_page.rb and also a new
step in links_steps.rb.
> Also,would identifying the element by xpath help instead of by text?
> probably then we could reuse the element.
>
> I know css identification is not supported for certain types but I checked
> the documentation on cheezy/pageobjects.
>
> xpath seemed to be supported.
>
I would prefer css over xpath. If you could find a reliable way to
identify the particular elements containing the link text by way of css or
xpath, that would be a really good improvement to the existing test. It
might be challenging.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/qa/attachments/20140519/dbeccc10/attachment.html>
More information about the QA
mailing list