OzFramework / oz

Oz is a behavioral web-ui testing framework developed to reduce test maintenance by using a predictive model rather than a scriptive model when writing tests.
Apache License 2.0
23 stars 7 forks source link

try to dynamically find the element type from xpath #136

Open Castone22 opened 5 years ago

Castone22 commented 5 years ago

Attempts to reduce replication by checking if the element type is present within the xpath if it's provided, then passes that as a watir element, still supports manual overriding failing an auto detection.

Currently:

add_static_text(:mission_statement, element_type: :h2, xpath: '//section[@class="main-content"]//h2[@class="fancy-text"]')

Given the element type was actually provided in the xpath (h2[@class="fancy-text"]]), it makes sense for Oz to be able to infer it from the path, letting us do:

add_static_text(:mission_statement, xpath: '//section[@class="main-content"]//h2[@class="fancy-text"]')
greenarrowdb commented 5 years ago

No description provided.

Castone22 commented 5 years ago

Allows oz to create attempt to infer the element type from an xpath if it is used.

greenarrowdb commented 5 years ago

That's the 'what' but what is the 'why'? :)

Castone22 commented 5 years ago

To reduce replication :)

greenarrowdb commented 5 years ago

Of what? please provide a use case (yes I know we talked about this one, but I am trying to keep things clean) :)

Castone22 commented 5 years ago

Might make sense to make this also work for css selectors... though given they are less likely to specify the exact element type you're looking for, and that they have a less standard format than xpaths, might be a lot of work for very little gain.

ThePROX commented 5 years ago

What is the current status of this merge request? Are we going forward with this pattern, or does it require some discussion?