Module: GlobalMethods

Overview

This module contains methods that will be almost universally useful, and don’t pertain to any specific area or widget or pop up on a given page.

The primary method provided in this module is of the type .open_<page>(‘target_text’). Depending on the type of <page> specified, the method will return the appropriate Class object.

Instance Method Summary collapse

Methods included from PageObject

#method_missing, #name_li, #name_link

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageObject

Instance Method Details

#close_notificationObject

Clicks the X in the Notification box, to dismiss it.



95
96
97
98
# File 'lib/sakai-oae-test-api/global_methods.rb', line 95

def close_notification
  self.div(:class=>"gritter-item").hover
  self.div(:class=>"gritter-close").fire_event "onclick"
end

This method exposes the “draggable” menu items in the left-hand menus, so that you can use Watir’s <X>.drag_and_drop_on <Y> method. Note that not all matching menu items are necessarily draggable. Also useful if you just want to see if the menu item is visible on the page



105
106
107
# File 'lib/sakai-oae-test-api/global_methods.rb', line 105

def menu_item(name)
  self.div(:class=>/lhnavigation(_subnav|)_item_content/, :text=>name)
end

#open_page(name) ⇒ Object

This method is essentially identical with the open_link methods listed above. It opens page/document items that are listed on the page–for example in the Recent activity box. There is an important distinction, however: This method should be used in cases when clicking the link results in a new browser tab/window being generated. May ultimately convert this to open_public_<object> if that seems the best generic way to handle things.

THIS METHOD MAY SOON BE DEPRECATED (if so, it will be included as an alias of open_content)



76
77
78
79
80
81
# File 'lib/sakai-oae-test-api/global_methods.rb', line 76

def open_page(name)
  name_link(name).click
  self.wait_for_ajax
  self.window(:title=>"rSmart | Content Profile").use
  ContentDetailsPage.new @browser
end

#view_person(name) ⇒ Object Also known as: view_profile

Clicks the link of the specified name (It will click any link on the page, really, but it should be used for Person links only, because it instantiates the ViewPerson Class)



86
87
88
89
90
91
# File 'lib/sakai-oae-test-api/global_methods.rb', line 86

def view_person(name)
  name_link(name).click
  sleep 3
  self.wait_for_ajax
  ViewPerson.new @browser
end