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

Cas/new page helpers #149

Closed Castone22 closed 5 years ago

Castone22 commented 5 years ago

RELIES ON #148

Exposes some new methods on corepage for interacting with the elements on the page.

This allows for somewhat more readable language when interacting with elements on a given page, and plays nicely into creating navigation methods that use args

Assuming we've defined

add_route(:CasualDressesPage, [:navigate_to, :dresses, :casual_dresses])

using the new functionality added in #148, the navigate_to method we've written can now be defined with somewhat less awkward syntax than before.

  def navigate_to(menu, sub_section)
    hover_over :"#{menu}_button"
    wait_for :"#{sub_section}_button", timeout: 3
    activate :"#{sub_section}_button"
    click_on :"#{sub_section}_button"
    deactivate :"#{sub_section}_button"
  end

Reads like a set of instructions that you're giving rather than

    sub_section_link = @elements[:"#{sub_section}_button"]
    hover_over :"#{menu}_button"
    CoreUtils.wait_until(3) {element.present?}
    sub_section_link.activate
    sub_section_link.click
    sub_section_link.deactivate

Which feels somewhat disjointed when you read it.