Class: Calendar
- Inherits:
-
CalendarBase
- Object
- PageFactory
- BasePage
- CalendarBase
- Calendar
- Defined in:
- lib/sambal-cle/page_objects/calendar.rb
Overview
Top page of the Calendar For now it includes all views, though that probably means it will have to be re-instantiated every time a new view is selected.
Instance Method Summary collapse
-
#event_href(title) ⇒ Object
Returns the href value of the target link use for validation when you are testing whether the link will appear again on another screen, since often times validation by title text alone will not work.
-
#events_list ⇒ Object
(also: #event_list)
Returns an array for the listed events.
-
#open_event(title) ⇒ Object
Clicks the link to the specified event, then instantiates the EventDetail class.
Methods inherited from CalendarBase
Methods inherited from BasePage
basic_page_elements, button, damballa, frame_element, link
Instance Method Details
#event_href(title) ⇒ Object
Returns the href value of the target link use for validation when you are testing whether the link will appear again on another screen, since often times validation by title text alone will not work.
51 52 53 54 |
# File 'lib/sambal-cle/page_objects/calendar.rb', line 51 def event_href(title) truncated = title[0..5] frm.link(:text=>/#{Regexp.escape(truncated)}/).href end |
#events_list ⇒ Object Also known as: event_list
Returns an array for the listed events. This array contains more than simply strings of the event titles, because often the titles are truncated to fit on the screen. In addition, getting the “title” tag of the link is often problematic because titles can contain double-quotes, which will mess up the HTML of the anchor tag (there is probably an XSS vulnerability to exploit, there. This should be extensively tested.).
Because of these issues, the array contains the title tag, the anchor text, and the entire href string for every event listed on the page. Having all three items available should ensure that verification steps don’t give false results–especially when you are doing a negative test (checking that an event is NOT present).
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sambal-cle/page_objects/calendar.rb', line 92 def events_list list = {} if frm.table(:class=>"calendar").exist? events_table = frm.table(:class=>"calendar") else events_table = frm.table(:class=>"listHier lines nolines") end events_table.links.each do |link| list.store(link.title, {:text=>link.text, :href=>link.href, :html=>link.html[/(?<="location=").+doDescription/] } ) end list end |
#open_event(title) ⇒ Object
Clicks the link to the specified event, then instantiates the EventDetail class.
42 43 44 45 |
# File 'lib/sambal-cle/page_objects/calendar.rb', line 42 def open_event(title) truncated = title[0..5] frm.link(:text=>/#{Regexp.escape(truncated)}/).click end |