java - Is Ruby compatible with strict Page Object Pattern? -


i have built various test automation frameworks using page object pattern java (https://code.google.com/p/selenium/wiki/pageobjects).

two of big benefits have found are:

1) can see methods available when have instance of page (e.g. typing homepage. show me actions/methods can call homepage)

2) because navigation methods (e.g. gotohomepage()) return instance of subsequent page (e.g. homepage), can navigate through tests writing code , seeing takes you.

e.g.

welcomepage welcomepage = loginpage.loginwithvaliduser(validuser); paymentspage paymentspage = welcomepage.gotopaymentspage(); 

these benefits work java since type of object (or page in case) known ide.

however, ruby, object type not fixed @ point , ambiguous ide. therefore, cannot see how can realise these benefits on automation suite built using ruby (e.g. using cucumber).

can show me how use ruby page object pattern gain these benefits?

from further investigation, looks initial requirement can fulfilled using instance variables:

given(/^i on launch page$/)   @launch_page ||= launchpage.new end  when(/^i open set alarm time page$/)   @set_alarm_page = @launch_page.goto_set_alarm_page end  when(/^i open our apps home page$/)   @launch_page.navigation_toolbar.open_our_apps end  then(/^i should see homepage alarm time (\d+)$/) |alarm_time|   alarm_time_actual = @launch_page.get_alarm_time   assert_equal(alarm_time, alarm_time_actual) end 

as long somewhere on step definition class explicitly create new page object (in above example: launchpage.new), subsequent pages appear , provide intellisense method/property values.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -