Closed titusfortner closed 7 years ago
Watir 6.7 is released. I think I've removed all extraneous changes such that this is mostly just a transition to more direct use of Watir with element interactions.
Hmm I'm not sure if the last bullet point on this page is still correct: https://github.com/cheezy/page-object/wiki/Support-for-both-watir-webdriver-and-selenium-webdriver#locating-elements
If that is important, this gem might need to explicitly define #name
and call #attribute
with it, since Watir only supports it for elements where name is a valid attribute in the spec.
TODO - make sure that my Table#find_index
implementation is limited to looking at just first column rather than any cell in a row.
This code will only work if this PR in Watir makes it into the eventual 6.7 release. I've tested it against a local build of Watir with that PR included. I'm presenting this PR to show how the two would work together if we decide to go this route.
Of note: The scrolling until visible test doesn't test anything. Removing the
when
statement will still give a passing test. "#visible?" is the same as "#present?" except it throws an exception if#exist? == false
. Honestly, I think it's kind of useless to have both of these in Watir; I'm not sure why it was implemented this way. Regardless, neither of them deals with the viewport, or what can physically be seen on the screen. To get information about the viewport we'd need to do something like this, which might not be a bad thing all things considered. So I'm also not sure what to do with the various waiting and checking methods for present and visible in the page object code. Watir deprecated a lot of the special things and has told people to upgrade to usingelement.wait_until(&:present?)
type signatures. Theoretically most of these in the page object code can be aliased because they all take the same actions. The question is what return values and/or error messages are desired.Also,
Media#has_controls?
can't use#alias_method
in Page Object code because of metaprogramming. Rather than adding a special case to Watir, I'm wondering if it would be overkill to also definemethods for `isand
has_` for Boolean values in Watir's AttributeHelpers. You essentially only have one attribute that would make use of it, and I'd be fascinated to know if there were a single user making use of it in the wild. :-DThoughts and feedback appreciated as always.